|
From: Daniel J. <dan...@us...> - 2007-05-02 23:59:17
|
Update of /cvsroot/boost-sandbox/boost-sandbox/libs/unordered/doc In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv22727/doc Modified Files: comparison.qbk hash_equality.qbk Log Message: Remove use of quickbook 1.4 features from unordered container documentation, so it'll build with quickbook 1.3 (will put them back soon-ish). Index: hash_equality.qbk =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/libs/unordered/doc/hash_equality.qbk,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- hash_equality.qbk 18 Mar 2007 20:00:57 -0000 1.4 +++ hash_equality.qbk 2 May 2007 23:59:14 -0000 1.5 @@ -34,9 +34,37 @@ sure you use a hash function that matches it. For example, a case-insensitive dictionary: -[import src_code/insensitive.cpp] -[case_insensitive_functions] -[case_insensitive_dictionary] + struct iequal_to + : std::binary_function<std::string, std::string, bool> + { + bool operator()(std::string const& x, + std::string const& y) const + { + return boost::algorithm::iequals(x, y); + } + }; + + struct ihash + : std::unary_function<std::string, bool> + { + bool operator()(std::string const& x) const + { + std::size_t seed = 0; + + for(std::string::const_iterator it = x.begin(); + it != x.end(); ++it) + { + boost::hash_combine(seed, std::toupper(*it)); + } + + return seed; + } + }; + + struct word_info; + + boost::unordered_map<std::string, word_info, ihash, iequal_to> + idictionary; A more generic version of this example is available at: [@../../libs/unordered/examples/case_insensitive.hpp /libs/unordered/examples/case_insensitive.hpp] Index: comparison.qbk =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/libs/unordered/doc/comparison.qbk,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- comparison.qbk 18 Mar 2007 20:00:57 -0000 1.7 +++ comparison.qbk 2 May 2007 23:59:14 -0000 1.8 @@ -14,10 +14,7 @@ ] [ [`Compare` exposed by member typedef `key_compare`, accessed by member function `key_comp()`] - [ - `Hash` exposed by member typedef `hasher`, accessed by member function `hash_function()`. - - `Pred` by member typedef `key_equal` and member function `key_eq()`.] + [`Hash` exposed by member typedef `hasher`, accessed by member function `hash_function()`.\n`Pred` by member typedef `key_equal` and member function `key_eq()`.] ] [ [Member typedef `value_compare` supplies an ordering comparison for member elements, accessed by member function `value_comp()`.] |