Having trouble getting non_member versions to work

This commit is contained in:
Randolph Voorhies
2013-06-11 19:40:17 -07:00
parent a5dcb04c97
commit 149771df0f
3 changed files with 185 additions and 81 deletions

View File

@@ -38,13 +38,20 @@ struct Test3
int a;
std::string b;
template<class Archive>
void serialize(int & ar, unsigned int version)
{
ar & a;
}
};
#if 1
//namespace cereal
//{
template<class Archive>
void serialize(Archive & ar, Test3 & t, unsigned int version)
{
//ar & t.a;
//ar & t.b;
}
//}
#endif
// ###################################
struct Test4
{
@@ -70,6 +77,19 @@ struct Test4
}
};
//// ######################################################################
//template<typename> struct Void { typedef void type; };
//
//template<typename T, class A, typename Sfinae = void>
//struct has_non_member_serialize2: std::false_type {};
//
//template<typename T, class A>
//struct has_non_member_serialize2< T, A,
// typename Void<
//decltype( cereal::serialize( std::declval<A&>(), std::declval<T&>(), 0 ) )
// >::type
// >: std::true_type {};
// ######################################################################
int main()
{
@@ -80,13 +100,16 @@ int main()
Test3 t3;
Test4 t4;
archive & t1;
archive & t2;
//archive & t1;
//archive & t2;
//archive & t3;
//archive & t4;
//cereal::serialize(archive, t3, 0);
std::cout << cereal::traits::has_non_member_serialize<Test2, cereal::BinaryOutputArchive>() << std::endl;
//std::cout << has_non_member_serialize2<Test3, cereal::BinaryOutputArchive>() << std::endl;
return 0;
}