Boost logo

Boost :

From: Bronek Kozicki (b.kozicki_at_[hidden])
Date: 2005-03-09 05:28:31


> The library is fairly small and can be seen as an extension to
> boost.functional.
> Therefore the review is a fast-track review.

Documentation mentions two overloaded functions:
  std::size_t hash_value(std::string);
  std::size_t hash_value(std::wstring);

while hash.hpp actually delivers one template function:
  template <class E, class T, class A>
  std::size_t hash_value(std::basic_string<E, T, A> const& v);

I'd prefer documentation updated. Overall I consider this
functionality desired in Boost; I also like design (single template
class hash calling overloaded hash_function). I implemented similar
functionality in the past (as many of us did, I'm pretty sure), and
this design is something I would not be ashamed of, if I wrote it
myself. I would however consider implementing most overloads of
hash_value inline; I know that from technical perspective compiler is
free to inline function call anyway, but putting implementation in
header will make optimizer job easier and more obvious to user.

B.

-- 
Bronek Kozicki     brok_at_[hidden]     http://b.kozicki.pl/

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk