demo_pimpl.cpp 781 B

12345678910111213141516171819202122232425262728293031323334
  1. /////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
  2. // demo_pimpl.cpp
  3. // (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
  4. // Use, modification and distribution is subject to the Boost Software
  5. // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
  6. // http://www.boost.org/LICENSE_1_0.txt)
  7. // should pass compilation and execution
  8. #include <sstream>
  9. #include <boost/archive/text_iarchive.hpp>
  10. #include <boost/archive/text_oarchive.hpp>
  11. #include "demo_pimpl_A.hpp"
  12. int main(int argc, char* argv[])
  13. {
  14. std::stringstream ss;
  15. const A a;
  16. {
  17. boost::archive::text_oarchive oa(ss);
  18. oa << a;
  19. }
  20. A a1;
  21. {
  22. boost::archive::text_iarchive ia(ss);
  23. ia >> a1;
  24. }
  25. return 0;
  26. }