Home | Libraries | People | FAQ | More |
boost::hash_range — Calculate the combined hash value of the elements of an iterator range.
template<typename It> std::size_t hash_range(It first, It last); template<typename It> void hash_range(std::size_t& seed, It first, It last);
Effects: For the two argument overload:
size_t seed = 0; for(; first != last; ++first) { hash_combine(seed, *first); } return seed;For the three arguments overload:
for(; first != last; ++first) { hash_combine(seed, *first); }
hash_range
is sensitive to the order of the elements
so it wouldn't be appropriate to use this with an unordered
container.
This is an extension to TR1
hash_value(std::iterator_traits<It>::value_type)
throws. hash_range(std::size_t&, It, It)
has basic exception safety as long as
hash_value(std::iterator_traits<It>::value_type)
has basic exception safety.
Copyright © 2005 Daniel James |