-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathderived_one.cc
24 lines (19 loc) · 851 Bytes
/
derived_one.cc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#include "derived_one.hh"
#include "filesystem_path_archive.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>
#include <boost/serialization/base_object.hpp>
#include <boost/serialization/string.hpp>
DerivedOne::DerivedOne(std::filesystem::path p) : path{std::move(p)} {}
void DerivedOne::foo() {}
template<class Archive>
void DerivedOne::serialize(Archive &ar, unsigned int) {
// You must start with base object in derived classes.
ar &boost::serialization::base_object<Base>(*this);
// Boost knows how to serialize this due to filesystem_path_archive.hh
ar &path;
}
// Must occur outside of a namespace, inside class source file.
BOOST_CLASS_EXPORT_IMPLEMENT(DerivedOne)