Added a MapItem to wrap key/value pairs

This commit is contained in:
Randolph Voorhies
2013-07-03 20:05:34 -07:00
parent 3885d8b537
commit d24c0e2db2
3 changed files with 101 additions and 9 deletions

View File

@@ -299,9 +299,9 @@ int main()
assert(e_in == e_out);
{
//std::stringstream os;
std::ofstream os("out.xml");
cereal::XMLOutputArchive oar( os );
//cereal::XMLOutputArchive oar( std::cout );
oar( cereal::make_nvp("hello", 5 ) );
@@ -311,6 +311,15 @@ int main()
auto intptr = std::make_shared<int>(99);
oar( CEREAL_NVP(intptr) );
std::map<std::string, int> map1 =
{
{"one", 1},
{"two", 2},
{"three", 3}
};
oar( CEREAL_NVP(map1) );
int x = 3;
oar( CEREAL_NVP(x) );
oar( 5 );
@@ -353,6 +362,14 @@ int main()
iar( CEREAL_NVP(intptr) );
assert( *intptr == 99 );
std::map<std::string, int> map1;
iar( CEREAL_NVP(map1) );
assert( map1["one"] == 1 );
assert( map1["two"] == 2 );
assert( map1["three"] == 3 );
int x;
iar( CEREAL_NVP(x) );
assert( x == 3 );