diff --git a/include/fc/interprocess/container.hpp b/include/fc/interprocess/container.hpp index 32f6a95..1b74011 100644 --- a/include/fc/interprocess/container.hpp +++ b/include/fc/interprocess/container.hpp @@ -7,9 +7,9 @@ #include #include #include +#include #include - namespace fc { namespace bip = boost::interprocess; @@ -72,6 +72,29 @@ namespace fc { } } + template + void to_variant( const bip::vector& t, fc::variant& v ) + { + if( t.size() ) + v = variant(fc::to_hex(t.data(), t.size())); + else + v = ""; + } + + template + void from_variant( const fc::variant& v, bip::vector& d ) + { + auto str = v.as_string(); + d.resize( str.size() / 2 ); + if( d.size() ) + { + size_t r = fc::from_hex( str, d.data(), d.size() ); + FC_ASSERT( r == d.size() ); + } + // std::string b64 = base64_decode( var.as_string() ); + // vo = std::vector( b64.c_str(), b64.c_str() + b64.size() ); + } + namespace raw { namespace bip = boost::interprocess;