11 #include <boost/serialization/nvp.hpp>
12 #include <boost/serialization/split_free.hpp>
14 #include <immer/array.hpp>
15 #include <immer/array_transient.hpp>
19 template<
class Archive,
22 void save(Archive &ar,
const immer::array<T, MP> &v,
const unsigned int )
25 ar << BOOST_SERIALIZATION_NVP(size);
27 for (
const auto &i : v) {
32 template<
class Archive,
35 void load(Archive &ar, immer::array<T, MP> &v,
const unsigned int )
37 using VecT = immer::array<T, MP>;
38 using TransientT = decltype(v.transient());
39 using SizeT = decltype(v.size());
40 using ValueT =
typename VecT::value_type;
43 ar >> BOOST_SERIALIZATION_NVP(size);
44 TransientT
transient = VecT(size).transient();
46 for (
auto i = SizeT{}; i != size; ++i) {
49 transient.set(i, std::move(val));
52 v =
transient.persistent();
55 template<
class Archive,
58 inline void serialize(Archive &ar, immer::array<T, MP> &v,
const unsigned int version)
60 boost::serialization::split_free(ar, v, version);
Definition: immer-array.hpp:18
void load(Archive &ar, immer::array< T, MP > &v, const unsigned int)
Definition: immer-array.hpp:35
void serialize(Archive &ar, immer::array< T, MP > &v, const unsigned int version)
Definition: immer-array.hpp:58
void save(Archive &ar, const immer::array< T, MP > &v, const unsigned int)
Definition: immer-array.hpp:22