1 /////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
2 // test_non_serializable.cpp: test implementation level trait
3
4 // (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
5 // Use, modification and distribution is subject to the Boost Software
6 // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
7 // http://www.boost.org/LICENSE_1_0.txt)
8
9 // test implementation level "not_serializable"
10 // should fail compilation
11
12 #include <fstream>
13
14 #include "test_tools.hpp"
15 #include <boost/serialization/level.hpp>
16 #include <boost/serialization/nvp.hpp>
17
18 class A
19 {
20 };
21
BOOST_CLASS_IMPLEMENTATION(A,boost::serialization::not_serializable)22 BOOST_CLASS_IMPLEMENTATION(A, boost::serialization::not_serializable)
23
24 void out(A & a)
25 {
26 test_ostream os("testfile", TEST_STREAM_FLAGS);
27 test_oarchive oa(os, TEST_ARCHIVE_FLAGS);
28 oa << BOOST_SERIALIZATION_NVP(a);
29 }
30
in(A & a)31 void in(A & a)
32 {
33 test_istream is("testfile", TEST_STREAM_FLAGS);
34 test_iarchive ia(is, TEST_ARCHIVE_FLAGS);
35 ia >> BOOST_SERIALIZATION_NVP(a);
36 }
37
38 int
test_main(int,char * [])39 test_main( int /* argc */, char* /* argv */[] )
40 {
41 A a;
42 out(a);
43 in(a);
44 return EXIT_SUCCESS;
45 }
46
47 // EOF
48