1 2 // Copyright 2018 Peter Dimov. 3 // 4 // Distributed under the Boost Software License, Version 1.0. 5 // 6 // See accompanying file LICENSE_1_0.txt or copy at 7 // http://www.boost.org/LICENSE_1_0.txt 8 9 #include <boost/archive/text_iarchive.hpp> 10 #include <boost/archive/text_oarchive.hpp> 11 #include <boost/core/lightweight_test.hpp> 12 #include <sstream> 13 #include <string> 14 main()15int main() 16 { 17 std::ostringstream os; 18 std::string s1( "pumpkin pie" ); 19 20 { 21 boost::archive::text_oarchive oa( os ); 22 oa << s1; 23 } 24 25 std::istringstream is( os.str() ); 26 std::string s2; 27 28 { 29 boost::archive::text_iarchive ia( is ); 30 ia >> s2; 31 } 32 33 BOOST_TEST_EQ( s1, s2 ); 34 35 return boost::report_errors(); 36 } 37