Hash: Merge deprecated header warning + some documentation.

[SVN r78697]
This commit is contained in:
Daniel James
2012-05-27 21:13:49 +00:00
parent 681b79aaf9
commit 9d67f4ccd3
9 changed files with 108 additions and 7 deletions
+11 -1
View File
@@ -198,5 +198,15 @@ To calculate the hash of an iterator range you can use [funcref boost::hash_rang
std::vector<std::string> some_strings;
std::size_t hash = ``[funcref boost::hash_range]``(some_strings.begin(), some_strings.end());
[endsect]
Note that when writing template classes, you might not want to include the main
hash header as it's quite an expensive include that brings in a lot of other
headers, so instead you can include the `<boost/functional/hash_fwd.hpp>`
header which forward declares [classref boost::hash],
[funcref boost::hash_range] and [funcref boost::hash_combine]. You'll need to
include the main header before instantiating [classref boost::hash]. When using
a container that uses [classref boost::hash] it should do that for you, so your
type will work fine with the boost hash containers. There's an example of this
in [@boost:/libs/unordered/examples/template.hpp template.hpp] and
[@boost:/libs/unordered/examples/template.cpp template.cpp].
[endsect]