]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/serialization/example/demo_pimpl_A.cpp
bump version to 18.2.2-pve1
[ceph.git] / ceph / src / boost / libs / serialization / example / demo_pimpl_A.cpp
CommitLineData
7c673cae
FG
1/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
2// demo_pimpl_A.cpp
3
f67539c2 4// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
7c673cae
FG
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#include <boost/archive/text_iarchive.hpp>
10#include <boost/archive/text_oarchive.hpp>
11
12#include "demo_pimpl_A.hpp"
13
14// "hidden" definition of class B
15struct B {
16 int b;
17 template<class Archive>
18 void serialize(Archive & ar, const unsigned int /* file_version */){
19 ar & b;
20 }
21};
22
23A::A() :
24 pimpl(new B)
25{}
26A::~A(){
27 delete pimpl;
28}
29// now we can define the serialization for class A
30template<class Archive>
31void A::serialize(Archive & ar, const unsigned int /* file_version */){
32 ar & pimpl;
33}
f67539c2 34
7c673cae
FG
35// without the explicit instantiations below, the program will
36// fail to link for lack of instantiantiation of the above function
37// note: the following failed to fix link errors for vc 7.0 !
38template void A::serialize<boost::archive::text_iarchive>(
f67539c2 39 boost::archive::text_iarchive & ar,
7c673cae
FG
40 const unsigned int file_version
41);
42template void A::serialize<boost::archive::text_oarchive>(
f67539c2 43 boost::archive::text_oarchive & ar,
7c673cae
FG
44 const unsigned int file_version
45);