// (C) Copyright Andy Tompkins 2007. Permission to copy, use, modify, sell and // distribute this software is granted provided this copyright notice appears // in all copies. This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // Distributed under the Boost Software License, Version 1.0. (See // accompanying file LICENSE_1_0.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // Purpose to test serializing uuids with narrow archives #include #include #include #include #include #include #include #include #include #include #include #include template void test_archive() { using namespace std; using namespace boost::uuids; OStringStreamType o_stream; uuid u1 = {{0x12, 0x34, 0x56, 0x78, 0x90, 0xab, 0xcd, 0xef, 0x12, 0x34, 0x56, 0x78, 0x90, 0xab, 0xcd, 0xef}}; uuid u2; // save { OArchiveType oa(o_stream); oa << BOOST_SERIALIZATION_NVP(u1); } //cout << "stream:" << o_stream.str() << "\n\n"; // load { IStringStreamType i_stream(o_stream.str()); IArchiveType ia(i_stream); ia >> BOOST_SERIALIZATION_NVP(u2); } BOOST_TEST_EQ(u1, u2); } int main( int /* argc */, char* /* argv */[] ) { using namespace std; using namespace boost::archive; test_archive(); test_archive(); test_archive(); return boost::report_errors(); }