Ferenc Szontágh
2024-06-27 0c428a79ef2379c6c7be29712e83f8c39e43c580
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