test_pimpl.cpp 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. /////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
  2. // test_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 <boost/compatibility/cpp_c_headers/cstdio> // for tmpnam
  9. #include <fstream>
  10. #include <boost/serialization/nvp.hpp>
  11. #include "test_tools.hpp"
  12. class B;
  13. class A {
  14. friend boost::serialization::access;
  15. B *pimpl;
  16. template<class Archive>
  17. void serialize(Archive & ar, const unsigned int file_version);
  18. };
  19. int test_main( int argc, char* argv[] )
  20. {
  21. char testfile[TMP_MAX];
  22. std::tmpnam(testfile);
  23. // BOOST_REQUIRE(NULL != testfile);
  24. A a, a1;
  25. {
  26. test_ostream os(testfile, TEST_STREAM_FLAGS);
  27. test_oarchive oa(os);
  28. oa << BOOST_SERIALIZATION_NVP(a);
  29. }
  30. {
  31. test_istream is(testfile, TEST_STREAM_FLAGS);
  32. test_iarchive ia(is);
  33. BOOST_SERIALIZATION_NVP(a1);
  34. }
  35. // BOOST_CHECK(a != a1);
  36. return 0;
  37. }
  38. // EOF