mirror of
https://github.com/XRPLF/rippled.git
synced 2025-11-19 18:45:52 +00:00
Remove boost::hash_value() overloads.
This addresses https://ripplelabs.atlassian.net/browse/RIPD-102
This commit is contained in:
committed by
Nik Bougalis
parent
0c5c901222
commit
f5eb22253d
@@ -702,16 +702,6 @@ struct uhash
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
struct call_hash_value
|
|
||||||
{
|
|
||||||
template <class T>
|
|
||||||
std::size_t
|
|
||||||
operator()(T const& t) const noexcept
|
|
||||||
{
|
|
||||||
return hash_value(t);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
} // beast
|
} // beast
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -131,8 +131,6 @@ hash_append (Hasher& h, URL const& url)
|
|||||||
hash_append (h, url.toString());
|
hash_append (h, url.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
extern std::size_t hash_value (beast::URL const& url);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
@@ -143,7 +141,7 @@ template <>
|
|||||||
struct hash <beast::URL>
|
struct hash <beast::URL>
|
||||||
{
|
{
|
||||||
std::size_t operator() (beast::URL const& v) const
|
std::size_t operator() (beast::URL const& v) const
|
||||||
{ return beast::hash_value (v); }
|
{ return v.toString().hash(); }
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -164,14 +164,4 @@ std::ostream& operator<< (std::ostream &os, URL const& url)
|
|||||||
return os;
|
return os;
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
std::size_t hash_value (URL const& v)
|
|
||||||
{
|
|
||||||
return std::size_t (v.toString().hash());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// boost::hash support
|
|
||||||
@@ -24,6 +24,8 @@
|
|||||||
#include <beast/net/IPAddressV6.h>
|
#include <beast/net/IPAddressV6.h>
|
||||||
#include <beast/container/hash_append.h>
|
#include <beast/container/hash_append.h>
|
||||||
|
|
||||||
|
#include <boost/functional/hash.hpp>
|
||||||
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include <ios>
|
#include <ios>
|
||||||
#include <string>
|
#include <string>
|
||||||
@@ -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. */
|
/** Returns the address represented as a string. */
|
||||||
inline std::string to_string (Address const& addr)
|
inline std::string to_string (Address const& addr)
|
||||||
{
|
{
|
||||||
@@ -337,7 +329,19 @@ struct hash <beast::IP::Address>
|
|||||||
std::size_t
|
std::size_t
|
||||||
operator() (beast::IP::Address const& addr) const
|
operator() (beast::IP::Address const& addr) const
|
||||||
{
|
{
|
||||||
return hash_value (addr);
|
return beast::uhash<>{} (addr);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace boost {
|
||||||
|
template <>
|
||||||
|
struct hash <beast::IP::Address>
|
||||||
|
{
|
||||||
|
std::size_t
|
||||||
|
operator() (beast::IP::Address const& addr) const
|
||||||
|
{
|
||||||
|
return beast::uhash<>{} (addr);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,6 +23,7 @@
|
|||||||
#include <beast/container/hash_append.h>
|
#include <beast/container/hash_append.h>
|
||||||
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
#include <functional>
|
||||||
#include <ios>
|
#include <ios>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
@@ -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. */
|
/** Returns the address represented as a string. */
|
||||||
std::string to_string (AddressV4 const& addr);
|
std::string to_string (AddressV4 const& addr);
|
||||||
|
|
||||||
@@ -197,7 +194,7 @@ template <>
|
|||||||
struct hash <beast::IP::AddressV4>
|
struct hash <beast::IP::AddressV4>
|
||||||
{
|
{
|
||||||
std::size_t operator() (beast::IP::AddressV4 const& addr) const
|
std::size_t operator() (beast::IP::AddressV4 const& addr) const
|
||||||
{ return hash_value (addr); }
|
{ return addr.value; }
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -22,6 +22,7 @@
|
|||||||
|
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
#include <functional>
|
||||||
#include <ios>
|
#include <ios>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
@@ -78,10 +79,6 @@ hash_append(Hasher&, AddressV6 const&)
|
|||||||
assert(false);
|
assert(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** boost::hash support. */
|
|
||||||
inline std::size_t hash_value (AddressV6 const&)
|
|
||||||
{ assert(false); return 0; }
|
|
||||||
|
|
||||||
/** Returns the address represented as a string. */
|
/** Returns the address represented as a string. */
|
||||||
std::string to_string (AddressV6 const& addr);
|
std::string to_string (AddressV6 const& addr);
|
||||||
|
|
||||||
@@ -104,7 +101,7 @@ template <>
|
|||||||
struct hash <beast::IP::AddressV6>
|
struct hash <beast::IP::AddressV6>
|
||||||
{
|
{
|
||||||
std::size_t operator() (beast::IP::AddressV6 const& addr) const
|
std::size_t operator() (beast::IP::AddressV6 const& addr) const
|
||||||
{ return hash_value (addr); }
|
{ assert(false); return 0; }
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -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. */
|
/** Returns the endpoint represented as a string. */
|
||||||
inline std::string to_string (Endpoint const& endpoint)
|
inline std::string to_string (Endpoint const& endpoint)
|
||||||
{ return endpoint.to_string(); }
|
{ return endpoint.to_string(); }
|
||||||
@@ -161,7 +158,17 @@ template <>
|
|||||||
struct hash <beast::IP::Endpoint>
|
struct hash <beast::IP::Endpoint>
|
||||||
{
|
{
|
||||||
std::size_t operator() (beast::IP::Endpoint const& endpoint) const
|
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 <beast::IP::Endpoint>
|
||||||
|
{
|
||||||
|
std::size_t operator() (beast::IP::Endpoint const& endpoint) const
|
||||||
|
{ return beast::uhash<>{} (endpoint); }
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -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 <Port> () (endpoint.port ()))
|
|
||||||
+ 0x9e3779b9 + (seed << 6) + (seed >> 2);
|
|
||||||
return seed;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::istream& operator>> (std::istream& is, Endpoint& endpoint)
|
std::istream& operator>> (std::istream& is, Endpoint& endpoint)
|
||||||
{
|
{
|
||||||
// VFALCO TODO Support ipv6!
|
// VFALCO TODO Support ipv6!
|
||||||
|
|||||||
Reference in New Issue
Block a user