libkazv
immer-box.hpp
Go to the documentation of this file.
1 /*
2  * This file is part of libkazv.
3  * SPDX-FileCopyrightText: 2021 Tusooa Zhu <tusooa@kazv.moe>
4  * SPDX-License-Identifier: AGPL-3.0-or-later
5  */
6 
7 
8 #pragma once
9 
10 #include <libkazv-config.hpp>
11 
12 #include <boost/serialization/nvp.hpp>
13 #include <boost/serialization/split_free.hpp>
14 
15 #include <immer/box.hpp>
16 
17 namespace boost::serialization
18 {
19 
20  template <class Archive, class T, class MP>
21  void save(Archive &ar, const immer::box<T, MP> &box, const unsigned int /* version */)
22  {
23  ar << box.get();
24  }
25 
26  template <class Archive, class T, class MP>
27  void load(Archive &ar, immer::box<T, MP> &box, const unsigned int /* version */)
28  {
29  T val;
30  ar >> val;
31 
32  box = val;
33  }
34 
35  template<class Archive, class T, class MP>
36  inline void serialize(Archive &ar, immer::box<T, MP> &box, const unsigned int version)
37  {
38  boost::serialization::split_free(ar, box, version);
39  }
40 
41 }
boost::serialization::serialize
void serialize(Archive &ar, immer::array< T, MP > &v, const unsigned int version)
Definition: immer-array.hpp:58
boost::serialization
Definition: immer-array.hpp:17
boost::serialization::save
void save(Archive &ar, const immer::array< T, MP > &v, const unsigned int)
Definition: immer-array.hpp:22
boost::serialization::load
void load(Archive &ar, immer::array< T, MP > &v, const unsigned int)
Definition: immer-array.hpp:35
libkazv-config.hpp