#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include struct Archive {}; struct Test { template void serialzize( Archive & ) { std::cout << "hey there" << std::endl; } template void save( Archive & ) const { std::cout << "saved by the bell" << std::endl; } template void load( Archive & ) { std::cout << "locked and loaded" << std::endl; } template static void load_and_construct( Archive &, cereal::construct & ) { } template int save_minimal() const { return 0; } template int save_minimal(const std::uint32_t) const { return 1; } template void load_minimal( int & ) { } }; template void serialize( Archive &, Test & ) { } template void load( Archive &, Test & ) { } template void save( Archive &, Test const & ) { } template int save_minimal( Test const & ) { return 0; } template int save_minimal( Test const &, const std::uint32_t ) { return 0; } namespace cereal { template <> struct LoadAndConstruct { template static void load_and_construct( Archive &, cereal::construct & construct ) { construct(); } }; } struct A { virtual void foo() = 0; }; struct B : A { void foo() {} template void serialize( Archive & ) { std::cout << "i'm in your b" << std::endl; } }; struct C { char a; }; //CEREAL_REGISTER_TYPE(B); class MemberMinimal { public: MemberMinimal() = default; template int save_minimal( Archive const & ) const { return x; } template void load_minimal( Archive const &, int const & str ) { x = str; } public: int x; }; int main() { typedef Test T; std::cout << std::boolalpha; // Test Load and Construct internal/external std::cout << "\tload_and_construct" << std::endl; std::cout << cereal::traits::has_member_load_and_construct::value << std::endl; std::cout << cereal::traits::has_non_member_load_and_construct::value << std::endl; // serialize std::cout << "\tserialize" << std::endl; std::cout << cereal::traits::has_member_serialize::value << std::endl; std::cout << cereal::traits::has_non_member_serialize::value << std::endl; // load std::cout << "\tload" << std::endl; std::cout << cereal::traits::has_member_load::value << std::endl; std::cout << cereal::traits::has_non_member_load::value << std::endl; // load minimal std::cout << "\tload minimal" << std::endl; std::cout << cereal::traits::has_member_load::value << std::endl; // save std::cout << "\tsave" << std::endl; std::cout << cereal::traits::has_member_save::value << std::endl; std::cout << cereal::traits::has_non_member_save::value << std::endl; // save_minimal std::cout << "\tsave_minimal" << std::endl; std::cout << cereal::traits::has_member_save_minimal::value << std::endl; std::cout << cereal::traits::has_non_member_save_minimal::value << std::endl; // save_minimal_versioned std::cout << "\tsave_minimal versioned" << std::endl; std::cout << cereal::traits::has_member_versioned_save_minimal::value << std::endl; std::cout << cereal::traits::has_non_member_versioned_save_minimal::value << std::endl; // splittable std::cout << "\t splittable" << std::endl; std::cout << cereal::traits::has_member_split::value << std::endl; std::cout << cereal::traits::has_non_member_split::value << std::endl; // serialiable std::cout << "\toutput serializable" << std::endl; std::cout << cereal::traits::is_output_serializable::value << std::endl; std::cout << cereal::traits::is_input_serializable::value << std::endl; // specialized std::cout << "\tspecialized" << std::endl; std::cout << cereal::traits::detail::is_specialized_member_serialize::value << std::endl; std::cout << cereal::traits::detail::is_specialized_member_load_save::value << std::endl; std::cout << cereal::traits::detail::is_specialized_non_member_serialize::value << std::endl; std::cout << cereal::traits::detail::is_specialized_non_member_load_save::value << std::endl; std::cout << cereal::traits::detail::is_specialized_error::value << std::endl; std::cout << cereal::traits::is_specialized::value << std::endl; // array size std::cout << typeid(A).name() << std::endl; std::cout << typeid(cereal::traits::has_load_and_construct).name() << std::endl; // extra testing std::cout << "\textra" << std::endl; std::cout << cereal::traits::has_member_save_minimal::value << std::endl; std::cout << cereal::traits::has_member_load_minimal::value << std::endl; return 0; }