Fixing static_assert messages

This commit is contained in:
Randolph Voorhies
2013-06-19 17:04:32 -07:00
parent f8502c368c
commit d82ecd7b63
3 changed files with 12 additions and 7 deletions

View File

@@ -255,9 +255,9 @@ namespace cereal
"Types must either have a serialize function, or separate save/load functions (but not both).\n" "Types must either have a serialize function, or separate save/load functions (but not both).\n"
"Serialize functions generally have the following signature:\n\n" "Serialize functions generally have the following signature:\n\n"
"template<class Archive>\n" "template<class Archive>\n"
" void serialize(int & ar)\n" " void serialize(Archive & ar)\n"
" {\n" " {\n"
" ar & member1 & member2 & member3;\n" " ar( member1, member2, member3 );\n"
" }\n\n" ); " }\n\n" );
return *self; return *self;
} }
@@ -396,9 +396,9 @@ namespace cereal
"Types must either have a serialize function, or separate save/load functions (but not both).\n" "Types must either have a serialize function, or separate save/load functions (but not both).\n"
"Serialize functions generally have the following signature:\n\n" "Serialize functions generally have the following signature:\n\n"
"template<class Archive>\n" "template<class Archive>\n"
" void serialize(int & ar)\n" " void serialize(Archive & ar)\n"
" {\n" " {\n"
" ar & member1 & member2 & member3;\n" " ar( member1, member2, member3 );\n"
" }\n\n" ); " }\n\n" );
return *self; return *self;
} }

View File

@@ -62,7 +62,6 @@ namespace cereal
template<class T, class Archive> inline template<class T, class Archive> inline
static auto load_and_allocate(Archive & ar) -> decltype(T::load_and_allocate(ar)) static auto load_and_allocate(Archive & ar) -> decltype(T::load_and_allocate(ar))
{ {
std::cout << "yo2" << std::endl;
return T::load_and_allocate( ar ); return T::load_and_allocate( ar );
} }
}; };

View File

@@ -64,13 +64,15 @@ class Test2
template<class Archive> template<class Archive>
void save(Archive & ar) const void save(Archive & ar) const
{ {
ar(CEREAL_NVP(a)); ar(a);
//ar(CEREAL_NVP(a));
} }
template<class Archive> template<class Archive>
void load(Archive & ar) void load(Archive & ar)
{ {
ar(CEREAL_NVP(a)); ar(a);
//ar(CEREAL_NVP(a));
} }
}; };
@@ -220,10 +222,13 @@ int main()
e_out.t4 = {4}; e_out.t4 = {4};
e_out.s = "Hello, World!"; e_out.s = "Hello, World!";
Test2 t2 = {22};
{ {
std::ofstream os("out.txt"); std::ofstream os("out.txt");
cereal::BinaryOutputArchive archive(os); cereal::BinaryOutputArchive archive(os);
archive(CEREAL_NVP(e_out)); archive(CEREAL_NVP(e_out));
archive(t2);
} }
Everything e_in; Everything e_in;
@@ -232,6 +237,7 @@ int main()
std::ifstream is("out.txt"); std::ifstream is("out.txt");
cereal::BinaryInputArchive archive(is); cereal::BinaryInputArchive archive(is);
archive(CEREAL_NVP(e_in)); archive(CEREAL_NVP(e_in));
archive(t2);
} }
assert(e_in == e_out);// assert(e_in == e_out);//