FC Updates from BitShares and myself #21
2 changed files with 17 additions and 4 deletions
|
|
@ -12,6 +12,7 @@
|
||||||
#include <fc/container/flat_fwd.hpp>
|
#include <fc/container/flat_fwd.hpp>
|
||||||
|
|
||||||
namespace fc {
|
namespace fc {
|
||||||
|
template<typename...> class static_variant;
|
||||||
class value;
|
class value;
|
||||||
class exception;
|
class exception;
|
||||||
namespace ip { class address; }
|
namespace ip { class address; }
|
||||||
|
|
@ -41,10 +42,19 @@ namespace fc {
|
||||||
return n.c_str();
|
return n.c_str();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
template<typename T, typename... A> struct get_typename<flat_set<T, A...>>
|
template<typename T> struct get_typename<flat_set<T>>
|
||||||
|
{
|
||||||
|
static const char* name() {
|
||||||
|
static std::string n = std::string("flat_set<") + get_typename<T>::name() + ">";
|
||||||
|
return n.c_str();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
template<typename... Ts>
|
||||||
|
struct get_typename<flat_set<static_variant<Ts...>, typename static_variant<Ts...>::type_lt>>
|
||||||
{
|
{
|
||||||
static const char* name() {
|
static const char* name() {
|
||||||
static std::string n = std::string("flat_set<") + get_typename<T>::name() + ">";
|
using TN = get_typename<static_variant<Ts...>>;
|
||||||
|
static std::string n = std::string("flat_set<") + TN::name() + ", " + TN::name() + "::type_lt>";
|
||||||
return n.c_str();
|
return n.c_str();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -182,7 +182,10 @@ BOOST_AUTO_TEST_CASE( nested_objects_test )
|
||||||
|
|
||||||
from_variant( v, sv1, nested_levels + 2 );
|
from_variant( v, sv1, nested_levels + 2 );
|
||||||
|
|
||||||
BOOST_CHECK( decltype(sv)::type_eq()(sv, sv1) );
|
auto sv_equal = [](const fc::static_variant<fc::test::item>& v1, const fc::static_variant<fc::test::item>& v2) {
|
||||||
|
return v1.get<fc::test::item>() == v2.get<fc::test::item>();
|
||||||
|
};
|
||||||
|
BOOST_CHECK( sv_equal(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 +218,7 @@ BOOST_AUTO_TEST_CASE( nested_objects_test )
|
||||||
|
|
||||||
from_variant( v, vec1, nested_levels + 3 );
|
from_variant( v, vec1, nested_levels + 3 );
|
||||||
|
|
||||||
BOOST_CHECK( std::equal(vec.begin(), vec.end(), vec1.begin(), decltype(vec)::value_type::type_eq()) );
|
BOOST_CHECK( std::equal(vec.begin(), vec.end(), vec1.begin(), sv_equal) );
|
||||||
|
|
||||||
// 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