mirror of
https://github.com/boostorg/unordered.git
synced 2025-07-31 11:57:15 +02:00
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). [SVN r3995]
This commit is contained in:
@@ -14,10 +14,7 @@
|
|||||||
]
|
]
|
||||||
[
|
[
|
||||||
[`Compare` exposed by member typedef `key_compare`, accessed by member function `key_comp()`]
|
[`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()`.\n`Pred` by member typedef `key_equal` and member function `key_eq()`.]
|
||||||
`Hash` exposed by member typedef `hasher`, accessed by member function `hash_function()`.
|
|
||||||
|
|
||||||
`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()`.]
|
[Member typedef `value_compare` supplies an ordering comparison for member elements, accessed by member function `value_comp()`.]
|
||||||
|
@@ -34,9 +34,37 @@ Alternatively, you might wish to use a different equality function. If so, make
|
|||||||
sure you use a hash function that matches it. For example, a
|
sure you use a hash function that matches it. For example, a
|
||||||
case-insensitive dictionary:
|
case-insensitive dictionary:
|
||||||
|
|
||||||
[import src_code/insensitive.cpp]
|
struct iequal_to
|
||||||
[case_insensitive_functions]
|
: std::binary_function<std::string, std::string, bool>
|
||||||
[case_insensitive_dictionary]
|
{
|
||||||
|
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:
|
A more generic version of this example is available at:
|
||||||
[@../../libs/unordered/examples/case_insensitive.hpp /libs/unordered/examples/case_insensitive.hpp]
|
[@../../libs/unordered/examples/case_insensitive.hpp /libs/unordered/examples/case_insensitive.hpp]
|
||||||
|
Reference in New Issue
Block a user