#pragma once #include "./lmdb-safe.hh" #include #include #include #include #include #include #include #include namespace LMDBSafe { template std::string serToString(const T &t) { auto ret = std::string(); auto inserter = boost::iostreams::back_insert_device(ret); auto stream = boost::iostreams::stream>(inserter); auto oa = boost::archive::binary_oarchive(stream, boost::archive::no_header | boost::archive::no_codecvt); oa << t; return ret; } template void serFromString(string_view str, T &ret) { auto source = boost::iostreams::array_source(str.data(), str.size()); auto stream = boost::iostreams::stream(source); auto ia = boost::archive::binary_iarchive(stream, boost::archive::no_header | boost::archive::no_codecvt); ia >> ret; } } // namespace LMDBSafe