g++ 4.7.3 compatability fixed

closes #38

Added a preprocessor define CEREAL_OLDER_GCC that exists if using
any GCC 4.7.x or earlier.  If this is defined some type traits change to
our original solution (prior to VS compatible), which is probably what we'd switch
to if VS ever gets around to fully supporting SFINAE and constexpr.

In map and set, as well as in unit tests, use insert instead of emplace for 4.7.x.
This commit is contained in:
Shane Grant
2013-12-22 13:25:06 -08:00
parent 456122cfd0
commit 436a0a275c
7 changed files with 66 additions and 12 deletions

View File

@@ -811,8 +811,13 @@ void test_map_memory()
for(int j=0; j<100; ++j)
{
#ifdef CEREAL_OLDER_GCC
o_uniqueptrMap.insert( std::make_pair(random_value<int>(gen), std::unique_ptr<int>( new int( random_value<int>(gen) ) )) );
o_sharedptrMap.insert( std::make_pair(random_value<int>(gen), std::make_shared<int>( random_value<int>(gen) )) );
#else // NOT CEREAL_OLDER_GCC
o_uniqueptrMap.emplace( random_value<int>(gen), std::unique_ptr<int>( new int( random_value<int>(gen) ) ) );
o_sharedptrMap.emplace( random_value<int>(gen), std::make_shared<int>( random_value<int>(gen) ) );
#endif // NOT CEREAL_OLDER_GCC
}
std::ostringstream os;