From 9b82dcde1019036abc69c02de86be36d10fa68a6 Mon Sep 17 00:00:00 2001 From: Daniel James Date: Wed, 14 Sep 2011 21:05:13 +0000 Subject: [PATCH] Unordered: Update equality documentation. [SVN r74377] --- doc/changes.qbk | 3 +- doc/rationale.qbk | 23 ---------- doc/ref.php | 46 +++++++++++++++++-- doc/ref.xml | 112 +++++++++++++++++++++++++++++++++++++++------- 4 files changed, 140 insertions(+), 44 deletions(-) diff --git a/doc/changes.qbk b/doc/changes.qbk index a10f2b70..574ed5fc 100644 --- a/doc/changes.qbk +++ b/doc/changes.qbk @@ -143,7 +143,8 @@ in some breaking changes: * Equality comparison has been changed to the C++11 specification. In a container with equivalent keys, elements in a group with equal keys used to have to be in the same order to be considered equal, - now they can be a permutation of each other. + now they can be a permutation of each other. To keep the old + behavior define the macro `BOOST_UNORDERED_DEPRECATED_EQUALITY`. * The behaviour of swap is different when the two containers to be swapped has unequal allocators. It used to allocate new nodes using diff --git a/doc/rationale.qbk b/doc/rationale.qbk index 25d5febb..c33788c0 100644 --- a/doc/rationale.qbk +++ b/doc/rationale.qbk @@ -90,29 +90,6 @@ efficiency advantage of power of 2 hash tables. So, this implementation uses a prime number for the hash table size. -[h2 Equality operators] - -/TODO/: This is out of date. - -`operator==` and `operator!=` are not included in the standard, but I've -added them as I think they could be useful and can be implemented -fairly efficiently. They are specified differently to the other standard -containers, comparing keys using the equality predicate rather than -`operator==`. - -It's also different to the proposal -[@http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2009/n2944.pdf n2944]. -which uses the equality operators for the whole of `value_type`. This -implementation just uses the key equality function for the key, -and `mapped_type`'s equality operator in `unordered_map` and -`unordered_multimap` for the mapped part of the element. - -Also, in `unordered_multimap`, the mapped values for a group of elements with -equivalent keys are only considered equal if they are in the same order, -in n2944 they just need to be a permutation of each other. Since the -order of elements with equal keys is now defined to be stable, it seems to me -that their order can be considered part of the container's value. - [h2 Active Issues and Proposals] [h3 C++0x allocators] diff --git a/doc/ref.php b/doc/ref.php index 036c10af..7d5c033d 100644 --- a/doc/ref.php +++ b/doc/ref.php @@ -967,9 +967,28 @@ EOL; const& bool + + + Return true if x.size() == + y.size and for every equivalent key group in + x, there is a group in y + for the same key, which is a permutation (using + operator== to compare the value types). + + + Return true if x.size() == + y.size and for every element in x, + there is an element in y with the same + for the same key, with an equal value (using + operator== to compare the value types). + + + - TODO: Documentation outdated. - This is a boost extension. + The behavior of this function was changed to match + the C++11 standard in Boost 1.48. If you wish to use + the old behaviour, define the macro + BOOST_UNORDERED_DEPRECATED_EQUALITY. Behavior is undefined if the two containers don't have equivalent equality predicates. @@ -991,9 +1010,28 @@ EOL; const& bool + + + Return false if x.size() == + y.size and for every equivalent key group in + x, there is a group in y + for the same key, which is a permutation (using + operator== to compare the value types). + + + Return false if x.size() == + y.size and for every element in x, + there is an element in y with the same + for the same key, with an equal value (using + operator== to compare the value types). + + + - TODO: Documentation outdated. - This is a boost extension. + The behavior of this function was changed to match + the C++11 standard in Boost 1.48. If you wish to use + the old behaviour, define the macro + BOOST_UNORDERED_DEPRECATED_EQUALITY. Behavior is undefined if the two containers don't have equivalent equality predicates. diff --git a/doc/ref.xml b/doc/ref.xml index 65d47952..d7ea13ee 100644 --- a/doc/ref.xml +++ b/doc/ref.xml @@ -847,9 +847,19 @@ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) unordered_set<Value, Hash, Pred, Alloc> const& bool + + Return true if x.size() == + y.size and for every element in x, + there is an element in y with the same + for the same key, with an equal value (using + operator== to compare the value types). + + - TODO: Documentation outdated. - This is a boost extension. + The behavior of this function was changed to match + the C++11 standard in Boost 1.48. If you wish to use + the old behaviour, define the macro + BOOST_UNORDERED_DEPRECATED_EQUALITY. Behavior is undefined if the two containers don't have equivalent equality predicates. @@ -872,9 +882,19 @@ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) unordered_set<Value, Hash, Pred, Alloc> const& bool + + Return false if x.size() == + y.size and for every element in x, + there is an element in y with the same + for the same key, with an equal value (using + operator== to compare the value types). + + - TODO: Documentation outdated. - This is a boost extension. + The behavior of this function was changed to match + the C++11 standard in Boost 1.48. If you wish to use + the old behaviour, define the macro + BOOST_UNORDERED_DEPRECATED_EQUALITY. Behavior is undefined if the two containers don't have equivalent equality predicates. @@ -1759,9 +1779,19 @@ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) unordered_multiset<Value, Hash, Pred, Alloc> const& bool + + Return true if x.size() == + y.size and for every equivalent key group in + x, there is a group in y + for the same key, which is a permutation (using + operator== to compare the value types). + + - TODO: Documentation outdated. - This is a boost extension. + The behavior of this function was changed to match + the C++11 standard in Boost 1.48. If you wish to use + the old behaviour, define the macro + BOOST_UNORDERED_DEPRECATED_EQUALITY. Behavior is undefined if the two containers don't have equivalent equality predicates. @@ -1784,9 +1814,19 @@ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) unordered_multiset<Value, Hash, Pred, Alloc> const& bool + + Return false if x.size() == + y.size and for every equivalent key group in + x, there is a group in y + for the same key, which is a permutation (using + operator== to compare the value types). + + - TODO: Documentation outdated. - This is a boost extension. + The behavior of this function was changed to match + the C++11 standard in Boost 1.48. If you wish to use + the old behaviour, define the macro + BOOST_UNORDERED_DEPRECATED_EQUALITY. Behavior is undefined if the two containers don't have equivalent equality predicates. @@ -2722,9 +2762,19 @@ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) unordered_map<Key, Mapped, Hash, Pred, Alloc> const& bool + + Return true if x.size() == + y.size and for every element in x, + there is an element in y with the same + for the same key, with an equal value (using + operator== to compare the value types). + + - TODO: Documentation outdated. - This is a boost extension. + The behavior of this function was changed to match + the C++11 standard in Boost 1.48. If you wish to use + the old behaviour, define the macro + BOOST_UNORDERED_DEPRECATED_EQUALITY. Behavior is undefined if the two containers don't have equivalent equality predicates. @@ -2749,9 +2799,19 @@ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) unordered_map<Key, Mapped, Hash, Pred, Alloc> const& bool + + Return false if x.size() == + y.size and for every element in x, + there is an element in y with the same + for the same key, with an equal value (using + operator== to compare the value types). + + - TODO: Documentation outdated. - This is a boost extension. + The behavior of this function was changed to match + the C++11 standard in Boost 1.48. If you wish to use + the old behaviour, define the macro + BOOST_UNORDERED_DEPRECATED_EQUALITY. Behavior is undefined if the two containers don't have equivalent equality predicates. @@ -3648,9 +3708,19 @@ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) unordered_multimap<Key, Mapped, Hash, Pred, Alloc> const& bool + + Return true if x.size() == + y.size and for every equivalent key group in + x, there is a group in y + for the same key, which is a permutation (using + operator== to compare the value types). + + - TODO: Documentation outdated. - This is a boost extension. + The behavior of this function was changed to match + the C++11 standard in Boost 1.48. If you wish to use + the old behaviour, define the macro + BOOST_UNORDERED_DEPRECATED_EQUALITY. Behavior is undefined if the two containers don't have equivalent equality predicates. @@ -3675,9 +3745,19 @@ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) unordered_multimap<Key, Mapped, Hash, Pred, Alloc> const& bool + + Return false if x.size() == + y.size and for every equivalent key group in + x, there is a group in y + for the same key, which is a permutation (using + operator== to compare the value types). + + - TODO: Documentation outdated. - This is a boost extension. + The behavior of this function was changed to match + the C++11 standard in Boost 1.48. If you wish to use + the old behaviour, define the macro + BOOST_UNORDERED_DEPRECATED_EQUALITY. Behavior is undefined if the two containers don't have equivalent equality predicates.