Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/boost_1_33_1/libs/serialization/test/test_const_pass.cpp @ 12

Last change on this file since 12 was 12, checked in by landauf, 17 years ago

added boost

File size: 1.4 KB
Line 
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
15struct A {
16    template<class Archive>
17    void serialize(Archive & ar, unsigned int version) {
18    }
19};
20
21// should compile w/o problem
22void 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}
28void 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}
34void 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}
40void 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
47void 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
Note: See TracBrowser for help on using the repository browser.