Template Function lsst::utils::hashIterable

Function Documentation

template<typename InputIterator>
std::size_t lsst::utils::hashIterable(std::size_t seed, InputIterator begin, InputIterator end)

Combine hashes in an iterable.

This is provided as a convenience for those who need to hash a container.

Shall not throw exceptions.

Return

A combined hash for all the elements in [begin, end).

Template Parameters
  • InputIterator: an iterator to the objects to be hashed. The pointed-to type must have a valid (in particular, non-throwing) specialization of std::hash.

Parameters
  • seed: An arbitrary starting value.

  • beginend: The range to hash.

To use it:

// Arbitrary seed; can change to get different hashes of same argument list
std::size_t seed = 0;
result = hashIterable(seed, container.begin(), container.end());