diff --git a/libdevcore/Common.h b/libdevcore/Common.h index ae98861c1..346bb53cf 100644 --- a/libdevcore/Common.h +++ b/libdevcore/Common.h @@ -85,6 +85,20 @@ using u160s = std::vector; using u256Set = std::set; using u160Set = std::set; +// Workaround for mixed type big int comparison bug introduced in boost 1.58 +// https://svn.boost.org/trac/boost/ticket/11328 +#define ETH_BIGINT_WRONG_COMPARISON_WORKAROUND(_OP) \ + template auto operator _OP (_T const& a, _U const& b) -> typename std::enable_if::value && std::is_same<_U, bigint>::value, bool>::type { return (bigint)a _OP b; } \ + template auto operator _OP (_U const& a, _T const& b) -> typename std::enable_if::value && std::is_same<_U, bigint>::value, bool>::type { return a _OP (bigint)b; } + +ETH_BIGINT_WRONG_COMPARISON_WORKAROUND(==) +ETH_BIGINT_WRONG_COMPARISON_WORKAROUND(!=) +ETH_BIGINT_WRONG_COMPARISON_WORKAROUND(>=) +ETH_BIGINT_WRONG_COMPARISON_WORKAROUND(<=) +ETH_BIGINT_WRONG_COMPARISON_WORKAROUND(<) +ETH_BIGINT_WRONG_COMPARISON_WORKAROUND(>) + + extern const u256 UndefinedU256; // Map types.