FC Updates from BitShares and myself #21
3 changed files with 11 additions and 11 deletions
|
|
@ -41,7 +41,7 @@ namespace fc {
|
||||||
return n.c_str();
|
return n.c_str();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
template<typename T> struct get_typename<flat_set<T>>
|
template<typename T, typename... A> struct get_typename<flat_set<T, A...>>
|
||||||
{
|
{
|
||||||
static const char* name() {
|
static const char* name() {
|
||||||
static std::string n = std::string("flat_set<") + get_typename<T>::name() + ">";
|
static std::string n = std::string("flat_set<") + get_typename<T>::name() + ">";
|
||||||
|
|
|
||||||
|
|
@ -302,6 +302,14 @@ public:
|
||||||
static constexpr int value = impl::position<X, Types...>::pos;
|
static constexpr int value = impl::position<X, Types...>::pos;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct type_lt {
|
||||||
|
bool operator()(const static_variant& a, const static_variant& b) const { return a.which() < b.which(); }
|
||||||
|
};
|
||||||
|
struct type_eq {
|
||||||
|
bool operator()(const static_variant& a, const static_variant& b) const { return a.which() == b.which(); }
|
||||||
|
};
|
||||||
|
using flat_set_type = flat_set<static_variant, type_lt>;
|
||||||
|
|
||||||
static_variant()
|
static_variant()
|
||||||
{
|
{
|
||||||
init_from_tag(0);
|
init_from_tag(0);
|
||||||
|
|
@ -352,14 +360,6 @@ public:
|
||||||
v.visit( impl::move_construct<static_variant>(*this) );
|
v.visit( impl::move_construct<static_variant>(*this) );
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
friend bool operator == ( const static_variant& a, const static_variant& b )
|
|
||||||
{
|
|
||||||
return a.which() == b.which();
|
|
||||||
}
|
|
||||||
friend bool operator < ( const static_variant& a, const static_variant& b )
|
|
||||||
{
|
|
||||||
return a.which() < b.which();
|
|
||||||
}
|
|
||||||
|
|
||||||
template<typename X, typename = type_in_typelist<X>>
|
template<typename X, typename = type_in_typelist<X>>
|
||||||
X& get() {
|
X& get() {
|
||||||
|
|
|
||||||
|
|
@ -182,7 +182,7 @@ BOOST_AUTO_TEST_CASE( nested_objects_test )
|
||||||
|
|
||||||
from_variant( v, sv1, nested_levels + 2 );
|
from_variant( v, sv1, nested_levels + 2 );
|
||||||
|
|
||||||
BOOST_CHECK( sv == sv1 );
|
BOOST_CHECK( decltype(sv)::type_eq()(sv, sv1) );
|
||||||
|
|
||||||
// both log and dump should never throw
|
// both log and dump should never throw
|
||||||
BOOST_TEST_MESSAGE( "========== About to log static_variant. ==========" );
|
BOOST_TEST_MESSAGE( "========== About to log static_variant. ==========" );
|
||||||
|
|
@ -215,7 +215,7 @@ BOOST_AUTO_TEST_CASE( nested_objects_test )
|
||||||
|
|
||||||
from_variant( v, vec1, nested_levels + 3 );
|
from_variant( v, vec1, nested_levels + 3 );
|
||||||
|
|
||||||
BOOST_CHECK( vec == vec1 );
|
BOOST_CHECK( std::equal(vec.begin(), vec.end(), vec1.begin(), decltype(vec)::value_type::type_eq()) );
|
||||||
|
|
||||||
// both log and dump should never throw
|
// both log and dump should never throw
|
||||||
BOOST_TEST_MESSAGE( "========== About to log vector. ==========" );
|
BOOST_TEST_MESSAGE( "========== About to log vector. ==========" );
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue