test_not_serializable.cpp 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. /////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
  2. // test_non_serializable.cpp: test implementation level trait
  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. // test implementation level "not_serializable"
  8. // should fail compilation
  9. #include <fstream>
  10. #include "test_tools.hpp"
  11. #include <boost/serialization/level.hpp>
  12. #include <boost/serialization/nvp.hpp>
  13. class A
  14. {
  15. };
  16. BOOST_CLASS_IMPLEMENTATION(A, boost::serialization::not_serializable)
  17. void out(A & a)
  18. {
  19. test_ostream os("testfile", TEST_STREAM_FLAGS);
  20. test_oarchive oa(os, TEST_ARCHIVE_FLAGS);
  21. oa << BOOST_SERIALIZATION_NVP(a);
  22. }
  23. void in(A & a)
  24. {
  25. test_istream is("testfile", TEST_STREAM_FLAGS);
  26. test_iarchive ia(is, TEST_ARCHIVE_FLAGS);
  27. ia >> BOOST_SERIALIZATION_NVP(a);
  28. }
  29. int
  30. test_main( int /* argc */, char* /* argv */[] )
  31. {
  32. A a;
  33. out(a);
  34. in(a);
  35. return EXIT_SUCCESS;
  36. }
  37. // EOF