id summary reporter owner description type status milestone component version severity resolution keywords cc 9755 Simple way to get hash. Rainer Deyke Daniel James "When writing custom hash_value functions, it is often useful to forward to the hash of another value. However, there is currently no short and simple way to do this. Consider: template struct C { some_complex_mpl_expression::type value; friend std::size_t hash_value() { // First attempt: requires knowledge of the type of the value to hash. return boost::hash::type>()(this->value); // Second attempt: two lines, not recommended. using namespace boost; return hash_value(this->value); // Third attempt: works, but requires three lines of code and doesn't yield the same hash as the first two attempts. std::size_t seed = 0; boost::hash_combine(seed, this->value); return seed; } }; I propose the addition of a simple function to calculate the hash of any arbitrary value, defined below: template std::size_t get_hash(T const& v) { return hash()(v); } This would allow me to write the above hash_value function with a single line of simple and correct code: friend std::size_t hash_value() { return boost::get_hash(this->value); } " Feature Requests new To Be Determined hash Boost 1.55.0 Cosmetic