-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathholder.cc
23 lines (18 loc) · 866 Bytes
/
holder.cc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#include "holder.hh"
// Must include the archive kinds with BOOST_CLASS_EXPORT_IMPLEMENT!
// Other choice can be: binary_iarchive, binary_oarchive
#include <boost/archive/text_iarchive.hpp>
#include <boost/archive/text_oarchive.hpp>
// To serialize shared_ptr, we include a shared_ptr.hpp.
// This is also the case for other containers: string, vector, map.
// You MUST include them when you want to serialize a container.
// However, note that not all containers have an include, and not
// all standard types are supported by boost serializer.
#include <boost/serialization/shared_ptr.hpp>
Holder::Holder(std::shared_ptr<Base> base) : base_ptr{std::move(base)} {}
template<class Archive>
void Holder::serialize(Archive &ar, unsigned int) {
ar &base_ptr;
}
// Must occur outside of a namespace, inside class source file.
BOOST_CLASS_EXPORT_IMPLEMENT(Holder)