diff --git a/include/fc/io/raw.hpp b/include/fc/io/raw.hpp index 12279fd..c402cbb 100644 --- a/include/fc/io/raw.hpp +++ b/include/fc/io/raw.hpp @@ -5,6 +5,7 @@ #include #include #include +#include #include #include #include @@ -177,6 +178,21 @@ namespace fc { template void unpack( Stream& s, fc::safe& v ) { unpack( s, v.value ); } + template + void pack( Stream& s, const fc::fwd& v ) { + pack( *v ); + } + + template + void unpack( Stream& s, fc::fwd& v ) { + unpack( *v ); + } + template + void pack( Stream& s, const fc::smart_ref& v ) { pack( s, *v ); } + + template + void unpack( Stream& s, fc::smart_ref& v ) { unpack( s, *v ); } + // optional template void pack( Stream& s, const fc::optional& v ) { diff --git a/include/fc/static_variant.hpp b/include/fc/static_variant.hpp index bd769e8..a977e58 100644 --- a/include/fc/static_variant.hpp +++ b/include/fc/static_variant.hpp @@ -270,11 +270,11 @@ public: } friend bool operator == ( const static_variant& a, const static_variant& b ) { - return a.wich() == b.which(); + return a.which() == b.which(); } friend bool operator < ( const static_variant& a, const static_variant& b ) { - return a.wich() < b.which(); + return a.which() < b.which(); } template diff --git a/include/fc/variant.hpp b/include/fc/variant.hpp index a373efb..ff670da 100644 --- a/include/fc/variant.hpp +++ b/include/fc/variant.hpp @@ -14,6 +14,7 @@ #include #include #include +#include namespace fc { @@ -44,6 +45,8 @@ namespace fc void to_variant( const blob& var, variant& vo ); void from_variant( const variant& var, blob& vo ); + template void to_variant( const smart_ref& s, variant& v ); + template void from_variant( const variant& v, smart_ref& s ); template void to_variant( const safe& s, variant& v ); template void from_variant( const variant& v, safe& s ); template void to_variant( const std::unique_ptr& s, variant& v ); @@ -534,6 +537,11 @@ namespace fc template void from_variant( const variant& v, safe& s ) { s.value = v.as_uint64(); } + template + void to_variant( const smart_ref& s, variant& v ) { v = *s; } + + template + void from_variant( const variant& v, smart_ref& s ) { from_variant( v, *s ); } variant operator + ( const variant& a, const variant& b ); variant operator - ( const variant& a, const variant& b );