mirror of
https://github.com/USCiLab/cereal.git
synced 2025-09-22 21:09:33 +02:00
Fixing issues with icc. refs #120
In sandbox_vs.cpp, there is a very strange issue with calling traits::is_input_serializable that causes icc 15.0.0 to crash. Everything else works great though.
This commit is contained in:
parent
e6cb01e89a
commit
28f9841fdb
@ -3,6 +3,7 @@ project (cereal)
|
||||
|
||||
option(SKIP_PORTABILITY_TEST "Skip portability tests" OFF)
|
||||
|
||||
set(CMAKE_CXX_COMPILER "icc")
|
||||
set(CMAKE_CXX_FLAGS "-std=c++11 -Wall -Werror -g -Wextra -Wshadow -pedantic ${CMAKE_CXX_FLAGS}")
|
||||
|
||||
include_directories(./include)
|
||||
|
@ -65,8 +65,8 @@ namespace cereal
|
||||
CEREAL_SAVE_FUNCTION_NAME( Archive & ar, std::vector<T, A> const & vector )
|
||||
{
|
||||
ar( make_size_tag( static_cast<size_type>(vector.size()) ) ); // number of elements
|
||||
for( auto it = vector.begin(), end = vector.end(); it != end; ++it )
|
||||
ar( *it );
|
||||
for(auto && v : vector)
|
||||
ar( v );
|
||||
}
|
||||
|
||||
//! Serialization for non-arithmetic vector types
|
||||
@ -79,8 +79,8 @@ namespace cereal
|
||||
ar( make_size_tag( size ) );
|
||||
|
||||
vector.resize( static_cast<std::size_t>( size ) );
|
||||
for( auto it = vector.begin(), end = vector.end(); it != end; ++it )
|
||||
ar( *it );
|
||||
for(auto && v : vector)
|
||||
ar( v );
|
||||
}
|
||||
|
||||
//! Serialization for bool vector types
|
||||
@ -88,8 +88,8 @@ namespace cereal
|
||||
void CEREAL_SAVE_FUNCTION_NAME( Archive & ar, std::vector<bool, A> const & vector )
|
||||
{
|
||||
ar( make_size_tag( static_cast<size_type>(vector.size()) ) ); // number of elements
|
||||
for( auto it = vector.begin(), end = vector.end(); it != end; ++it )
|
||||
ar( static_cast<bool>( *it ) );
|
||||
for(auto && v : vector)
|
||||
ar( static_cast<bool>(v) );
|
||||
}
|
||||
|
||||
//! Serialization for bool vector types
|
||||
@ -100,11 +100,11 @@ namespace cereal
|
||||
ar( make_size_tag( size ) );
|
||||
|
||||
vector.resize( static_cast<std::size_t>( size ) );
|
||||
for( auto it = vector.begin(), end = vector.end(); it != end; ++it )
|
||||
for(auto && v : vector)
|
||||
{
|
||||
bool b;
|
||||
ar( b );
|
||||
*it = b;
|
||||
v = b;
|
||||
}
|
||||
}
|
||||
} // namespace cereal
|
||||
|
@ -266,9 +266,9 @@ public:
|
||||
template <class Archive>
|
||||
static void load_and_construct( Archive & ar, cereal::construct<NoDefaultCtor> & construct )
|
||||
{
|
||||
int y;
|
||||
ar( y );
|
||||
construct( y, true );
|
||||
int yy;
|
||||
ar( yy );
|
||||
construct( yy, true );
|
||||
construct->z = 33;
|
||||
construct.ptr()->z = 33;
|
||||
}
|
||||
|
@ -208,7 +208,11 @@ int main()
|
||||
// serialiable
|
||||
std::cout << "\toutput serializable" << std::endl;
|
||||
std::cout << cereal::traits::is_output_serializable<T, Archive>::value << std::endl;
|
||||
|
||||
#if !defined(__INTEL_COMPILER)
|
||||
//! TODO: This causes icc to crash
|
||||
std::cout << cereal::traits::is_input_serializable<T, Archive>::value << std::endl;
|
||||
#endif
|
||||
|
||||
// specialized
|
||||
std::cout << "\tspecialized" << std::endl;
|
||||
|
@ -83,11 +83,11 @@ class MemoryCycleLoadAndConstruct
|
||||
template <class Archive>
|
||||
static void load_and_construct( Archive & ar, cereal::construct<MemoryCycleLoadAndConstruct> & construct )
|
||||
{
|
||||
int value;
|
||||
std::weak_ptr<MemoryCycleLoadAndConstruct> ptr;
|
||||
int val;
|
||||
std::weak_ptr<MemoryCycleLoadAndConstruct> p;
|
||||
|
||||
ar( value, ptr );
|
||||
construct( value, ptr );
|
||||
ar( val, p );
|
||||
construct( val, p );
|
||||
}
|
||||
|
||||
int value;
|
||||
|
Loading…
x
Reference in New Issue
Block a user