Quick Links: |
Provide hashAppend
for std::tuple
.
More...
hashAppend
for std::tuple
. bslh::hashAppend
, overloaded for the std::tuple
class template. Including this function allows for std::tuple
types (and types that contain them) to be used as keys in BDE hashed containers. std::tuple
first appears. char c = 'a'; short s = static_cast<short>(1); int i = 2; long l = 3L;
bslh::DefaultHashAlgorithm hasherS; hasherS(&c, sizeof(char)); hasherS(&s, sizeof(short)); hasherS(&i, sizeof(int)); hasherS(&l, sizeof(long)); bslh::DefaultHashAlgorithm::result_type hashS = hasherS.computeHash();
std::tuple
object. std::tuple<char, short, int, long> t = std::make_tuple(c, s, i, l); bslh::DefaultHashAlgorithm hasherT; bslh::hashAppend(hasherT, t); bslh::DefaultHashAlgorithm::result_type hashT = hasherT.computeHash();
assert(hashS == hashT);