Template Function lsst::utils::hashCombine(std::size_t, const T&, Rest…)

Function Documentation

template<typename T, typename ...Rest>
std::size_t lsst::utils::hashCombine(std::size_t seed, const T &value, Rest... rest)

Combine hashes

This is provided as a convenience for those who need to hash a composite. C++11 includes std::hash, but neglects to include a facility for combining hashes.

Shall not throw exceptions.

Return

A combined hash for all the arguments after seed.

Template Parameters
  • TRest: the types to hash. All types must have a valid (in particular, non-throwing) specialization of std::hash.

Parameters
  • seed: An arbitrary starting value.

  • valuerest: The objects to hash.

To use it:

// Arbitrary seed; can change to get different hashes of same argument list
std::size_t seed = 0;
result = hashCombine(seed, obj1, obj2, obj3);