From a7cd6c51731e22d587b95780a01fc74cb6fe957b Mon Sep 17 00:00:00 2001 From: Gav Wood Date: Thu, 25 Jun 2015 16:24:43 +0200 Subject: [PATCH] Make pretty function work again. RLP can use unordered_sets. --- libdevcore/Common.h | 8 ++++---- libdevcore/RLP.h | 18 +++++++++++------- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/libdevcore/Common.h b/libdevcore/Common.h index eafeb3d30..f1d35bbc7 100644 --- a/libdevcore/Common.h +++ b/libdevcore/Common.h @@ -218,17 +218,17 @@ private: #define DEV_TIMED(S) for (::std::pair<::dev::TimerHelper, bool> __eth_t(S, true); __eth_t.second; __eth_t.second = false) #define DEV_TIMED_SCOPE(S) ::dev::TimerHelper __eth_t(S) #if WIN32 -#define DEV_TIMED_FUNCTION DEV_TIMED_SCOPE(DEV_QUOTED(__FUNCSIG__)) +#define DEV_TIMED_FUNCTION DEV_TIMED_SCOPE(__FUNCSIG__) #else -#define DEV_TIMED_FUNCTION DEV_TIMED_SCOPE(DEV_QUOTED(__PRETTY_FUNCTION__)) +#define DEV_TIMED_FUNCTION DEV_TIMED_SCOPE(__PRETTY_FUNCTION__) #endif #define DEV_TIMED_ABOVE(S, MS) for (::std::pair<::dev::TimerHelper, bool> __eth_t(::dev::TimerHelper(S, MS), true); __eth_t.second; __eth_t.second = false) #define DEV_TIMED_SCOPE_ABOVE(S, MS) ::dev::TimerHelper __eth_t(S, MS) #if WIN32 -#define DEV_TIMED_FUNCTION_ABOVE(MS) DEV_TIMED_SCOPE_ABOVE(DEV_QUOTED(__FUNCSIG__), MS) +#define DEV_TIMED_FUNCTION_ABOVE(MS) DEV_TIMED_SCOPE_ABOVE(__FUNCSIG__, MS) #else -#define DEV_TIMED_FUNCTION_ABOVE(MS) DEV_TIMED_SCOPE_ABOVE(DEV_QUOTED(__PRETTY_FUNCTION__), MS) +#define DEV_TIMED_FUNCTION_ABOVE(MS) DEV_TIMED_SCOPE_ABOVE(__PRETTY_FUNCTION__, MS) #endif enum class WithExisting: int diff --git a/libdevcore/RLP.h b/libdevcore/RLP.h index 6ae9c165b..dee438be4 100644 --- a/libdevcore/RLP.h +++ b/libdevcore/RLP.h @@ -204,9 +204,7 @@ public: { ret.reserve(itemCount()); for (auto const& i: *this) - { ret.push_back((T)i); - } } return ret; } @@ -216,15 +214,21 @@ public: { std::set ret; if (isList()) - { for (auto const& i: *this) - { ret.insert((T)i); - } - } return ret; } - + + template + std::unordered_set toUnorderedSet() const + { + std::unordered_set ret; + if (isList()) + for (auto const& i: *this) + ret.insert((T)i); + return ret; + } + template std::pair toPair() const {