diff --git a/Builds/VisualStudio2013/RippleD.vcxproj b/Builds/VisualStudio2013/RippleD.vcxproj index 05c319ac77..41f5937c46 100644 --- a/Builds/VisualStudio2013/RippleD.vcxproj +++ b/Builds/VisualStudio2013/RippleD.vcxproj @@ -1,7 +1,7 @@  - {B7F39ECD-473C-484D-BC34-31F8362506A5} + {26B7D9AC-1A80-8EF8-6703-D061F1BECB75} Win32Proj RippleD true @@ -3383,9 +3383,6 @@ True - - True - True @@ -4106,4 +4103,4 @@ - \ No newline at end of file + diff --git a/Builds/VisualStudio2013/RippleD.vcxproj.filters b/Builds/VisualStudio2013/RippleD.vcxproj.filters index 44c1ef705e..59b7332d4c 100644 --- a/Builds/VisualStudio2013/RippleD.vcxproj.filters +++ b/Builds/VisualStudio2013/RippleD.vcxproj.filters @@ -4647,9 +4647,6 @@ ripple\types\impl - - ripple\types\impl - ripple\types\impl diff --git a/src/beast/beast/container/hash_append.h b/src/beast/beast/container/hash_append.h index 6f94c5c3fc..fa5a734547 100644 --- a/src/beast/beast/container/hash_append.h +++ b/src/beast/beast/container/hash_append.h @@ -702,16 +702,6 @@ struct uhash } }; -struct call_hash_value -{ - template - std::size_t - operator()(T const& t) const noexcept - { - return hash_value(t); - } -}; - } // beast #endif diff --git a/src/beast/beast/http/URL.h b/src/beast/beast/http/URL.h index c8bdfb3d2d..7b2b876ec1 100644 --- a/src/beast/beast/http/URL.h +++ b/src/beast/beast/http/URL.h @@ -131,8 +131,6 @@ hash_append (Hasher& h, URL const& url) hash_append (h, url.toString()); } -extern std::size_t hash_value (beast::URL const& url); - } //------------------------------------------------------------------------------ @@ -143,7 +141,7 @@ template <> struct hash { std::size_t operator() (beast::URL const& v) const - { return beast::hash_value (v); } + { return v.toString().hash(); } }; } diff --git a/src/beast/beast/http/impl/URL.cpp b/src/beast/beast/http/impl/URL.cpp index d1e772ebc1..1f6a9ebfdf 100644 --- a/src/beast/beast/http/impl/URL.cpp +++ b/src/beast/beast/http/impl/URL.cpp @@ -164,14 +164,4 @@ std::ostream& operator<< (std::ostream &os, URL const& url) return os; } -//------------------------------------------------------------------------------ - -std::size_t hash_value (URL const& v) -{ - return std::size_t (v.toString().hash()); } - -} - - -// boost::hash support \ No newline at end of file diff --git a/src/beast/beast/net/IPAddress.h b/src/beast/beast/net/IPAddress.h index 41ce4d1fbf..a9805c9bfc 100644 --- a/src/beast/beast/net/IPAddress.h +++ b/src/beast/beast/net/IPAddress.h @@ -24,6 +24,8 @@ #include #include +#include + #include #include #include @@ -277,16 +279,6 @@ is_public (Address const& addr) //------------------------------------------------------------------------------ -/** boost::hash support. */ -inline -std::size_t -hash_value (Address const& addr) -{ - return (addr.is_v4 ()) - ? hash_value (addr.to_v4()) - : hash_value (addr.to_v6()); -} - /** Returns the address represented as a string. */ inline std::string to_string (Address const& addr) { @@ -337,7 +329,19 @@ struct hash std::size_t operator() (beast::IP::Address const& addr) const { - return hash_value (addr); + return beast::uhash<>{} (addr); + } +}; +} + +namespace boost { +template <> +struct hash +{ + std::size_t + operator() (beast::IP::Address const& addr) const + { + return beast::uhash<>{} (addr); } }; } diff --git a/src/beast/beast/net/IPAddressV4.h b/src/beast/beast/net/IPAddressV4.h index ebb3a97469..6f9f380495 100644 --- a/src/beast/beast/net/IPAddressV4.h +++ b/src/beast/beast/net/IPAddressV4.h @@ -23,6 +23,7 @@ #include #include +#include #include #include #include @@ -164,10 +165,6 @@ bool is_public (AddressV4 const& addr); //------------------------------------------------------------------------------ -/** boost::hash support. */ -inline std::size_t hash_value (AddressV4 const& addr) - { return addr.value; } - /** Returns the address represented as a string. */ std::string to_string (AddressV4 const& addr); @@ -197,7 +194,7 @@ template <> struct hash { std::size_t operator() (beast::IP::AddressV4 const& addr) const - { return hash_value (addr); } + { return addr.value; } }; } diff --git a/src/beast/beast/net/IPAddressV6.h b/src/beast/beast/net/IPAddressV6.h index 3d1f542cf8..98d3377fd9 100644 --- a/src/beast/beast/net/IPAddressV6.h +++ b/src/beast/beast/net/IPAddressV6.h @@ -22,6 +22,7 @@ #include #include +#include #include #include #include @@ -78,10 +79,6 @@ hash_append(Hasher&, AddressV6 const&) assert(false); } -/** boost::hash support. */ -inline std::size_t hash_value (AddressV6 const&) - { assert(false); return 0; } - /** Returns the address represented as a string. */ std::string to_string (AddressV6 const& addr); @@ -104,7 +101,7 @@ template <> struct hash { std::size_t operator() (beast::IP::AddressV6 const& addr) const - { return hash_value (addr); } + { assert(false); return 0; } }; } diff --git a/src/beast/beast/net/IPEndpoint.h b/src/beast/beast/net/IPEndpoint.h index 41a147f54d..3d4cc731b4 100644 --- a/src/beast/beast/net/IPEndpoint.h +++ b/src/beast/beast/net/IPEndpoint.h @@ -132,9 +132,6 @@ inline bool is_public (Endpoint const& endpoint) //------------------------------------------------------------------------------ -/** boost::hash support. */ -std::size_t hash_value (Endpoint const& endpoint); - /** Returns the endpoint represented as a string. */ inline std::string to_string (Endpoint const& endpoint) { return endpoint.to_string(); } @@ -161,7 +158,17 @@ template <> struct hash { std::size_t operator() (beast::IP::Endpoint const& endpoint) const - { return hash_value (endpoint); } + { return beast::uhash<>{} (endpoint); } +}; +} + +namespace boost { +/** boost::hash support. */ +template <> +struct hash +{ + std::size_t operator() (beast::IP::Endpoint const& endpoint) const + { return beast::uhash<>{} (endpoint); } }; } diff --git a/src/beast/beast/net/impl/IPEndpoint.cpp b/src/beast/beast/net/impl/IPEndpoint.cpp index 1f07492397..d4a4fe8b30 100644 --- a/src/beast/beast/net/impl/IPEndpoint.cpp +++ b/src/beast/beast/net/impl/IPEndpoint.cpp @@ -137,15 +137,6 @@ bool operator< (Endpoint const& lhs, Endpoint const& rhs) //------------------------------------------------------------------------------ -std::size_t hash_value (Endpoint const& endpoint) -{ - std::size_t seed (hash_value (endpoint.address ())); - // boost::hash_combine() - seed ^= (std::hash () (endpoint.port ())) - + 0x9e3779b9 + (seed << 6) + (seed >> 2); - return seed; -} - std::istream& operator>> (std::istream& is, Endpoint& endpoint) { // VFALCO TODO Support ipv6! diff --git a/src/ripple/algorithm/api/CycledSet.h b/src/ripple/algorithm/api/CycledSet.h index 21569850f0..5b9df948c8 100644 --- a/src/ripple/algorithm/api/CycledSet.h +++ b/src/ripple/algorithm/api/CycledSet.h @@ -21,6 +21,7 @@ #define RIPPLE_TYPES_CYCLEDSET_H_INCLUDED #include +#include namespace ripple { @@ -37,6 +38,9 @@ template ContainerType; typedef typename ContainerType::iterator iterator; diff --git a/src/ripple/module/app/consensus/LedgerConsensus.cpp b/src/ripple/module/app/consensus/LedgerConsensus.cpp index b2ff907c5b..eda4b38773 100644 --- a/src/ripple/module/app/consensus/LedgerConsensus.cpp +++ b/src/ripple/module/app/consensus/LedgerConsensus.cpp @@ -1496,7 +1496,7 @@ private: } // if any peers have taken a contrary position, process disputes - boost::unordered_set found; + ripple::unordered_set found; for (auto& it : mPeerPositions) { @@ -1899,7 +1899,7 @@ private: // Disputed transactions ripple::unordered_map mDisputes; - boost::unordered_set mCompares; + ripple::unordered_set mCompares; // Close time estimates std::map mCloseTimes; diff --git a/src/ripple/module/app/ledger/OrderBookDB.cpp b/src/ripple/module/app/ledger/OrderBookDB.cpp index c649956ccb..f6e1424a36 100644 --- a/src/ripple/module/app/ledger/OrderBookDB.cpp +++ b/src/ripple/module/app/ledger/OrderBookDB.cpp @@ -60,10 +60,10 @@ void OrderBookDB::setup (Ledger::ref ledger) } static void updateHelper (SLE::ref entry, - boost::unordered_set< uint256 >& seen, + ripple::unordered_set< uint256 >& seen, ripple::unordered_map< RippleAsset, std::vector >& destMap, ripple::unordered_map< RippleAsset, std::vector >& sourceMap, - boost::unordered_set< RippleAsset >& XRPBooks, + ripple::unordered_set< RippleAsset >& XRPBooks, int& books) { if ((entry->getType () == ltDIR_NODE) && (entry->isFieldPresent (sfExchangeRate)) && @@ -96,10 +96,10 @@ static void updateHelper (SLE::ref entry, void OrderBookDB::update (Ledger::pointer ledger) { - boost::unordered_set< uint256 > seen; + ripple::unordered_set< uint256 > seen; ripple::unordered_map< RippleAsset, std::vector > destMap; ripple::unordered_map< RippleAsset, std::vector > sourceMap; - boost::unordered_set< RippleAsset > XRPBooks; + ripple::unordered_set< RippleAsset > XRPBooks; WriteLog (lsDEBUG, OrderBookDB) << "OrderBookDB::update>"; diff --git a/src/ripple/module/app/ledger/OrderBookDB.h b/src/ripple/module/app/ledger/OrderBookDB.h index da128f5dd9..8b274f0180 100644 --- a/src/ripple/module/app/ledger/OrderBookDB.h +++ b/src/ripple/module/app/ledger/OrderBookDB.h @@ -89,7 +89,7 @@ private: AssetToOrderBook mDestMap; // does an order book to XRP exist - boost::unordered_set mXRPBooks; + ripple::unordered_set mXRPBooks; typedef RippleRecursiveMutex LockType; typedef std::lock_guard ScopedLockType; diff --git a/src/ripple/module/app/misc/AmendmentTableImpl.cpp b/src/ripple/module/app/misc/AmendmentTableImpl.cpp index 5e71ba7ca5..f833a1c402 100644 --- a/src/ripple/module/app/misc/AmendmentTableImpl.cpp +++ b/src/ripple/module/app/misc/AmendmentTableImpl.cpp @@ -31,7 +31,7 @@ protected: typedef ripple::unordered_map amendmentMap_t; typedef std::pair amendmentIt_t; - typedef boost::unordered_set amendmentList_t; + typedef ripple::unordered_set amendmentList_t; typedef RippleMutex LockType; typedef std::lock_guard ScopedLockType; diff --git a/src/ripple/module/app/misc/NetworkOPs.cpp b/src/ripple/module/app/misc/NetworkOPs.cpp index 341b438219..08e575dcac 100644 --- a/src/ripple/module/app/misc/NetworkOPs.cpp +++ b/src/ripple/module/app/misc/NetworkOPs.cpp @@ -386,10 +386,10 @@ public: // InfoSub::Source // void subAccount (InfoSub::ref ispListener, - const boost::unordered_set& vnaAccountIDs, + const ripple::unordered_set& vnaAccountIDs, std::uint32_t uLedgerIndex, bool rt); void unsubAccount (std::uint64_t uListener, - const boost::unordered_set& vnaAccountIDs, + const ripple::unordered_set& vnaAccountIDs, bool rt); bool subLedger (InfoSub::ref ispListener, Json::Value& jvResult); @@ -2617,7 +2617,7 @@ void NetworkOPsImp::pubAccountTransaction (Ledger::ref lpCurrent, const Accepted // void NetworkOPsImp::subAccount (InfoSub::ref isrListener, - const boost::unordered_set& vnaAccountIDs, + const ripple::unordered_set& vnaAccountIDs, std::uint32_t uLedgerIndex, bool rt) { SubInfoMapType& subMap = rt ? mSubRTAccount : mSubAccount; @@ -2653,7 +2653,7 @@ void NetworkOPsImp::subAccount (InfoSub::ref isrListener, } void NetworkOPsImp::unsubAccount (std::uint64_t uSeq, - const boost::unordered_set& vnaAccountIDs, + const ripple::unordered_set& vnaAccountIDs, bool rt) { SubInfoMapType& subMap = rt ? mSubRTAccount : mSubAccount; diff --git a/src/ripple/module/app/peers/UniqueNodeList.cpp b/src/ripple/module/app/peers/UniqueNodeList.cpp index e33f4cac48..e60266669c 100644 --- a/src/ripple/module/app/peers/UniqueNodeList.cpp +++ b/src/ripple/module/app/peers/UniqueNodeList.cpp @@ -1025,7 +1025,7 @@ private: } } - boost::unordered_set usUNL; + ripple::unordered_set usUNL; if (!vsnNodes.empty ()) { @@ -2025,7 +2025,7 @@ private: // XXX Make this faster, make this the contents vector unsigned char or raw public key. // XXX Contents needs to based on score. - boost::unordered_set mUNL; + ripple::unordered_set mUNL; boost::posix_time::ptime mtpScoreNext; // When to start scoring. boost::posix_time::ptime mtpScoreStart; // Time currently started scoring. diff --git a/src/ripple/module/app/shamap/SHAMap.cpp b/src/ripple/module/app/shamap/SHAMap.cpp index 2f219e0015..1095057b45 100644 --- a/src/ripple/module/app/shamap/SHAMap.cpp +++ b/src/ripple/module/app/shamap/SHAMap.cpp @@ -114,11 +114,6 @@ void SHAMapNodeID::setMHash () const mHash = h; } -std::size_t hash_value (const SHAMapNodeID& mn) -{ - return mn.getMHash (); -} - SHAMap::pointer SHAMap::snapShot (bool isMutable) { SHAMap::pointer ret = std::make_shared (mType, diff --git a/src/ripple/module/app/shamap/SHAMapNodeID.h b/src/ripple/module/app/shamap/SHAMapNodeID.h index 050052fa85..bdd459034f 100644 --- a/src/ripple/module/app/shamap/SHAMapNodeID.h +++ b/src/ripple/module/app/shamap/SHAMapNodeID.h @@ -130,8 +130,6 @@ private: void setMHash () const; }; -extern std::size_t hash_value (SHAMapNodeID const& mn); - inline std::ostream& operator<< (std::ostream& out, SHAMapNodeID const& node) { return out << node.getString (); diff --git a/src/ripple/module/data/crypto/Base58Data.cpp b/src/ripple/module/data/crypto/Base58Data.cpp index 6ef34e5509..14ab2f3e99 100644 --- a/src/ripple/module/data/crypto/Base58Data.cpp +++ b/src/ripple/module/data/crypto/Base58Data.cpp @@ -77,14 +77,4 @@ std::string CBase58Data::ToString () const return Base58::encodeWithCheck (vch); } -std::size_t hash_value (const CBase58Data& b58) -{ - std::size_t seed = HashMaps::getInstance ().getNonce () - + (b58.nVersion * HashMaps::goldenRatio); - - boost::hash_combine (seed, b58.vchData); - - return seed; -} - } // ripple diff --git a/src/ripple/module/data/crypto/Base58Data.h b/src/ripple/module/data/crypto/Base58Data.h index d04b23d656..d96ca37afb 100644 --- a/src/ripple/module/data/crypto/Base58Data.h +++ b/src/ripple/module/data/crypto/Base58Data.h @@ -96,8 +96,6 @@ public: { beast::hash_append(hasher, value.vchData); } - - friend std::size_t hash_value (const CBase58Data& b58); }; inline bool @@ -136,8 +134,6 @@ operator>= (CBase58Data const& lhs, CBase58Data const& rhs) return lhs.compare (rhs) >= 0; } -extern std::size_t hash_value (const CBase58Data& b58); - } // ripple #endif diff --git a/src/ripple/module/net/rpc/InfoSub.h b/src/ripple/module/net/rpc/InfoSub.h index f3b16deae3..adf4b33923 100644 --- a/src/ripple/module/net/rpc/InfoSub.h +++ b/src/ripple/module/net/rpc/InfoSub.h @@ -55,11 +55,11 @@ public: public: // VFALCO TODO Rename the 'rt' parameters to something meaningful. virtual void subAccount (ref ispListener, - const boost::unordered_set& vnaAccountIDs, + const ripple::unordered_set& vnaAccountIDs, std::uint32_t uLedgerIndex, bool rt) = 0; virtual void unsubAccount (std::uint64_t uListener, - const boost::unordered_set& vnaAccountIDs, + const ripple::unordered_set& vnaAccountIDs, bool rt) = 0; // VFALCO TODO Document the bool return value @@ -130,11 +130,11 @@ protected: private: Consumer m_consumer; Source& m_source; - boost::unordered_set mSubAccountInfo; - boost::unordered_set mSubAccountTransaction; + ripple::unordered_set mSubAccountInfo; + ripple::unordered_set mSubAccountTransaction; std::shared_ptr mPathRequest; - std::uint64_t mSeq; + std::uint64_t mSeq; }; } // ripple diff --git a/src/ripple/module/rpc/handlers/Subscribe.cpp b/src/ripple/module/rpc/handlers/Subscribe.cpp index edcacc8286..ea48527468 100644 --- a/src/ripple/module/rpc/handlers/Subscribe.cpp +++ b/src/ripple/module/rpc/handlers/Subscribe.cpp @@ -142,7 +142,7 @@ Json::Value doSubscribe (RPC::Context& context) } else { - boost::unordered_set usnaAccoundIds = RPC::parseAccountIds (context.params_[strAccountsProposed]); + ripple::unordered_set usnaAccoundIds = RPC::parseAccountIds (context.params_[strAccountsProposed]); if (usnaAccoundIds.empty ()) { @@ -163,7 +163,7 @@ Json::Value doSubscribe (RPC::Context& context) } else { - boost::unordered_set usnaAccoundIds = RPC::parseAccountIds (context.params_["accounts"]); + ripple::unordered_set usnaAccoundIds = RPC::parseAccountIds (context.params_["accounts"]); if (usnaAccoundIds.empty ()) { diff --git a/src/ripple/module/rpc/handlers/Unsubscribe.cpp b/src/ripple/module/rpc/handlers/Unsubscribe.cpp index 217bfbed5d..44fb1b5a6f 100644 --- a/src/ripple/module/rpc/handlers/Unsubscribe.cpp +++ b/src/ripple/module/rpc/handlers/Unsubscribe.cpp @@ -88,7 +88,7 @@ Json::Value doUnsubscribe (RPC::Context& context) if (context.params_.isMember ("accounts_proposed") || context.params_.isMember ("rt_accounts")) { - boost::unordered_set usnaAccoundIds = RPC::parseAccountIds ( + ripple::unordered_set usnaAccoundIds = RPC::parseAccountIds ( context.params_.isMember ("accounts_proposed") ? context.params_["accounts_proposed"] : context.params_["rt_accounts"]); // DEPRECATED @@ -105,7 +105,7 @@ Json::Value doUnsubscribe (RPC::Context& context) if (context.params_.isMember ("accounts")) { - boost::unordered_set usnaAccoundIds = RPC::parseAccountIds (context.params_["accounts"]); + ripple::unordered_set usnaAccoundIds = RPC::parseAccountIds (context.params_["accounts"]); if (usnaAccoundIds.empty ()) { diff --git a/src/ripple/module/rpc/impl/ParseAccountIds.cpp b/src/ripple/module/rpc/impl/ParseAccountIds.cpp index 9b58864326..daea4936eb 100644 --- a/src/ripple/module/rpc/impl/ParseAccountIds.cpp +++ b/src/ripple/module/rpc/impl/ParseAccountIds.cpp @@ -22,9 +22,9 @@ namespace ripple { namespace RPC { -boost::unordered_set parseAccountIds (const Json::Value& jvArray) +ripple::unordered_set parseAccountIds (const Json::Value& jvArray) { - boost::unordered_set usnaResult; + ripple::unordered_set usnaResult; for (Json::Value::const_iterator it = jvArray.begin (); it != jvArray.end (); it++) { diff --git a/src/ripple/module/rpc/impl/ParseAccountIds.h b/src/ripple/module/rpc/impl/ParseAccountIds.h index cecb843d1e..fe1d95398f 100644 --- a/src/ripple/module/rpc/impl/ParseAccountIds.h +++ b/src/ripple/module/rpc/impl/ParseAccountIds.h @@ -23,7 +23,7 @@ namespace ripple { namespace RPC { -boost::unordered_set parseAccountIds (const Json::Value& jvArray); +ripple::unordered_set parseAccountIds (const Json::Value& jvArray); } // RPC } // ripple diff --git a/src/ripple/overlay/impl/OverlayImpl.cpp b/src/ripple/overlay/impl/OverlayImpl.cpp index 6eba837125..b3e2eb7909 100644 --- a/src/ripple/overlay/impl/OverlayImpl.cpp +++ b/src/ripple/overlay/impl/OverlayImpl.cpp @@ -479,9 +479,9 @@ OverlayImpl::onPeerActivated (Peer::ptr const& peer) { auto const result (m_publicKeyMap.emplace ( - boost::unordered::piecewise_construct, - boost::make_tuple (peer->getNodePublic()), - boost::make_tuple (peer))); + std::piecewise_construct, + std::make_tuple (peer->getNodePublic()), + std::make_tuple (peer))); assert(result.second); } diff --git a/src/ripple/overlay/impl/OverlayImpl.h b/src/ripple/overlay/impl/OverlayImpl.h index adee62a8b2..ac34430513 100644 --- a/src/ripple/overlay/impl/OverlayImpl.h +++ b/src/ripple/overlay/impl/OverlayImpl.h @@ -30,7 +30,6 @@ #include #include -#include #include // #include @@ -53,7 +52,7 @@ private: typedef std::unordered_map > PeersBySlot; - typedef boost::unordered_map < + typedef ripple::unordered_map < RippleAddress, Peer::ptr> PeerByPublicKey; typedef std::unordered_map < diff --git a/src/ripple/testoverlay/api/ConnectionType.h b/src/ripple/testoverlay/api/ConnectionType.h index 0ea55236fc..d22a3f1373 100644 --- a/src/ripple/testoverlay/api/ConnectionType.h +++ b/src/ripple/testoverlay/api/ConnectionType.h @@ -20,6 +20,13 @@ #ifndef RIPPLE_TESTOVERLAY_CONNECTIONTYPE_H_INCLUDED #define RIPPLE_TESTOVERLAY_CONNECTIONTYPE_H_INCLUDED +// HH Todo: Stop the practice of opening a namespace and #include +} // namespace ripple + +#include + +namespace ripple { + namespace TestOverlay { @@ -34,7 +41,7 @@ public: typedef typename State::UniqueID UniqueID; typedef std::vector Messages; - typedef boost::unordered_set MessageTable; + typedef ripple::unordered_set MessageTable; /** Create the 'no connection' object. */ ConnectionType () diff --git a/src/ripple/testoverlay/api/PeerType.h b/src/ripple/testoverlay/api/PeerType.h index 67c288dd8e..7d13c2031f 100644 --- a/src/ripple/testoverlay/api/PeerType.h +++ b/src/ripple/testoverlay/api/PeerType.h @@ -42,7 +42,7 @@ public: typedef ConnectionType Connection; typedef std::vector Connections; - typedef boost::unordered_set MessageTable; + typedef ripple::unordered_set MessageTable; explicit PeerType (Network& network) : m_network (network) diff --git a/src/ripple/types/api/UInt160.h b/src/ripple/types/api/UInt160.h index 86853f9612..9927808cbb 100644 --- a/src/ripple/types/api/UInt160.h +++ b/src/ripple/types/api/UInt160.h @@ -28,6 +28,7 @@ #include #include #include +#include namespace ripple { diff --git a/src/ripple/types/api/base_uint.h b/src/ripple/types/api/base_uint.h index 0e3eebb2be..d4eb55ce18 100644 --- a/src/ripple/types/api/base_uint.h +++ b/src/ripple/types/api/base_uint.h @@ -32,6 +32,8 @@ #include #include +#include + #include using beast::zero; @@ -402,13 +404,6 @@ typedef base_uint<128> uint128; typedef base_uint<160> uint160; typedef base_uint<256> uint256; -//------------------------------------------------------------------------------ -extern std::size_t hash_value (uint128 const&); -extern std::size_t hash_value (uint160 const&); -extern std::size_t hash_value (uint256 const&); - -//------------------------------------------------------------------------------ - template inline int compare ( base_uint const& a, base_uint const& b) @@ -526,4 +521,21 @@ inline std::ostream& operator<< ( } // rippled +namespace boost +{ + +template +struct hash> +{ + using argument_type = ripple::base_uint; + + std::size_t + operator()(argument_type const& u) const + { + return beast::hardened_hash{}(u); + } +}; + +} // boost + #endif diff --git a/src/ripple/types/impl/RippleAssets.cpp b/src/ripple/types/impl/RippleAssets.cpp index 603f81b6ec..667f533f49 100644 --- a/src/ripple/types/impl/RippleAssets.cpp +++ b/src/ripple/types/impl/RippleAssets.cpp @@ -222,11 +222,11 @@ public: testAssetSet > (); #endif - testcase ("boost::unordered_set "); - testAssetSet > (); + testcase ("ripple::unordered_set "); + testAssetSet > (); - testcase ("boost::unordered_set "); - testAssetSet > (); + testcase ("ripple::unordered_set "); + testAssetSet > (); } void testAssetMaps () @@ -425,11 +425,11 @@ public: testBookSet > (); #endif - testcase ("boost::unordered_set "); - testBookSet > (); + testcase ("ripple::unordered_set "); + testBookSet > (); - testcase ("boost::unordered_set "); - testBookSet > (); + testcase ("ripple::unordered_set "); + testBookSet > (); } void testBookMaps () diff --git a/src/ripple/types/impl/base_uint.cpp b/src/ripple/types/impl/base_uint.cpp deleted file mode 100644 index 6b75e1c32b..0000000000 --- a/src/ripple/types/impl/base_uint.cpp +++ /dev/null @@ -1,47 +0,0 @@ -//------------------------------------------------------------------------------ -/* - This file is part of rippled: https://github.com/ripple/rippled - Copyright (c) 2012, 2013 Ripple Labs Inc. - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -*/ -//============================================================================== - -namespace ripple { - -// NIKB TODO having a dependency on HashMaps sucks. Try to remove it and combine -// these functions into a single template. - -std::size_t hash_value (uint128 const& u) -{ - std::size_t seed = HashMaps::getInstance ().getNonce (); - - return beast::hardened_hash{seed}(u); -} - -std::size_t hash_value (uint160 const& u) -{ - std::size_t seed = HashMaps::getInstance ().getNonce (); - - return beast::hardened_hash{seed}(u); -} - -std::size_t hash_value (uint256 const& u) -{ - std::size_t seed = HashMaps::getInstance ().getNonce (); - - return beast::hardened_hash{seed}(u); -} - - -} \ No newline at end of file diff --git a/src/ripple/unity/types.cpp b/src/ripple/unity/types.cpp index c4b2f52430..ace5e7bccb 100644 --- a/src/ripple/unity/types.cpp +++ b/src/ripple/unity/types.cpp @@ -43,7 +43,6 @@ #include #include #include -#include #include #include #include