| 1 | /////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 |
|---|---|
| 2 | // test_const.cpp |
| 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 | // compile only |
| 10 | |
| 11 | #include <boost/archive/text_oarchive.hpp> |
| 12 | #include <boost/archive/text_iarchive.hpp> |
| 13 | #include <boost/serialization/nvp.hpp> |
| 14 | |
| 15 | struct A { |
| 16 | template<class Archive> |
| 17 | void serialize(Archive & ar, unsigned int version) { |
| 18 | } |
| 19 | }; |
| 20 | |
| 21 | // should compile w/o problem |
| 22 | void f1(boost::archive::text_oarchive & oa, const A & a){ |
| 23 | oa & a; |
| 24 | oa & BOOST_SERIALIZATION_NVP(a); |
| 25 | oa << a; |
| 26 | oa << BOOST_SERIALIZATION_NVP(a); |
| 27 | } |
| 28 | void f2(boost::archive::text_oarchive & oa, const A * const & a){ |
| 29 | oa & a; |
| 30 | oa & BOOST_SERIALIZATION_NVP(a); |
| 31 | oa << a; |
| 32 | oa << BOOST_SERIALIZATION_NVP(a); |
| 33 | } |
| 34 | void f3(boost::archive::text_iarchive & ia, A & a){ |
| 35 | ia & a; |
| 36 | ia & BOOST_SERIALIZATION_NVP(a); |
| 37 | ia >> a; |
| 38 | ia >> BOOST_SERIALIZATION_NVP(a); |
| 39 | } |
| 40 | void f4(boost::archive::text_iarchive & ia, A * & a){ |
| 41 | ia & a; |
| 42 | ia & BOOST_SERIALIZATION_NVP(a); |
| 43 | ia >> a; |
| 44 | ia >> BOOST_SERIALIZATION_NVP(a); |
| 45 | } |
| 46 | #if 0 |
| 47 | void f5(boost::archive::text_oarchive & oa, const A * & a){ |
| 48 | oa & a; |
| 49 | oa & BOOST_SERIALIZATION_NVP(a); |
| 50 | oa << a; |
| 51 | oa << BOOST_SERIALIZATION_NVP(a); |
| 52 | } |
| 53 | #endif |
| 54 | |
| 55 |
