1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
| #ifndef __SERIALIZE_H
| #define __SERIALIZE_H
|
| #include <tser/tser.hpp>
|
| namespace tser
| {
| template <typename T>
| inline void DeSerialize(const std::string &data, T &value)
| {
| tser::BinaryArchive archive(0);
| archive.initialize(data);
| value = archive.load<T>();
| };
|
| template <typename T>
| inline void Serialize(const T &value, std::string &data)
| {
| tser::BinaryArchive archive(0);
| archive.save(value);
| data = archive.get_buffer().data();
| };
| }
| #endif
|
|