Unordered: Update equality documentation.

[SVN r74377]
This commit is contained in:
Daniel James
2011-09-14 21:05:13 +00:00
parent b496bc3fa2
commit 9b82dcde10
4 changed files with 140 additions and 44 deletions

View File

@ -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

View File

@ -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]

View File

@ -967,9 +967,28 @@ EOL;
<paramtype><?php echo $full_type; ?> const&amp;</paramtype>
</parameter>
<type>bool</type>
<description>
<?php if($equivalent_keys): ?>
<para>Return <code>true</code> if <code>x.size() ==
y.size</code> and for every equivalent key group in
<code>x</code>, there is a group in <code>y</code>
for the same key, which is a permutation (using
<code>operator==</code> to compare the value types).
</para>
<?php else: ?>
<para>Return <code>true</code> if <code>x.size() ==
y.size</code> and for every element in <code>x</code>,
there is an element in <code>y</code> with the same
for the same key, with an equal value (using
<code>operator==</code> to compare the value types).
</para>
<?php endif; ?>
</description>
<notes>
<para><emphasis>TODO</emphasis>: Documentation outdated.</para>
<para>This is a boost extension.</para>
<para>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
<code>BOOST_UNORDERED_DEPRECATED_EQUALITY</code>.</para>
<para>Behavior is undefined if the two containers don't have
equivalent equality predicates.</para>
</notes>
@ -991,9 +1010,28 @@ EOL;
<paramtype><?php echo $full_type; ?> const&amp;</paramtype>
</parameter>
<type>bool</type>
<description>
<?php if($equivalent_keys): ?>
<para>Return <code>false</code> if <code>x.size() ==
y.size</code> and for every equivalent key group in
<code>x</code>, there is a group in <code>y</code>
for the same key, which is a permutation (using
<code>operator==</code> to compare the value types).
</para>
<?php else: ?>
<para>Return <code>false</code> if <code>x.size() ==
y.size</code> and for every element in <code>x</code>,
there is an element in <code>y</code> with the same
for the same key, with an equal value (using
<code>operator==</code> to compare the value types).
</para>
<?php endif; ?>
</description>
<notes>
<para><emphasis>TODO</emphasis>: Documentation outdated.</para>
<para>This is a boost extension.</para>
<para>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
<code>BOOST_UNORDERED_DEPRECATED_EQUALITY</code>.</para>
<para>Behavior is undefined if the two containers don't have
equivalent equality predicates.</para>
</notes>

View File

@ -847,9 +847,19 @@ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
<paramtype>unordered_set&lt;Value, Hash, Pred, Alloc&gt; const&amp;</paramtype>
</parameter>
<type>bool</type>
<description>
<para>Return <code>true</code> if <code>x.size() ==
y.size</code> and for every element in <code>x</code>,
there is an element in <code>y</code> with the same
for the same key, with an equal value (using
<code>operator==</code> to compare the value types).
</para>
</description>
<notes>
<para><emphasis>TODO</emphasis>: Documentation outdated.</para>
<para>This is a boost extension.</para>
<para>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
<code>BOOST_UNORDERED_DEPRECATED_EQUALITY</code>.</para>
<para>Behavior is undefined if the two containers don't have
equivalent equality predicates.</para>
</notes>
@ -872,9 +882,19 @@ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
<paramtype>unordered_set&lt;Value, Hash, Pred, Alloc&gt; const&amp;</paramtype>
</parameter>
<type>bool</type>
<description>
<para>Return <code>false</code> if <code>x.size() ==
y.size</code> and for every element in <code>x</code>,
there is an element in <code>y</code> with the same
for the same key, with an equal value (using
<code>operator==</code> to compare the value types).
</para>
</description>
<notes>
<para><emphasis>TODO</emphasis>: Documentation outdated.</para>
<para>This is a boost extension.</para>
<para>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
<code>BOOST_UNORDERED_DEPRECATED_EQUALITY</code>.</para>
<para>Behavior is undefined if the two containers don't have
equivalent equality predicates.</para>
</notes>
@ -1759,9 +1779,19 @@ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
<paramtype>unordered_multiset&lt;Value, Hash, Pred, Alloc&gt; const&amp;</paramtype>
</parameter>
<type>bool</type>
<description>
<para>Return <code>true</code> if <code>x.size() ==
y.size</code> and for every equivalent key group in
<code>x</code>, there is a group in <code>y</code>
for the same key, which is a permutation (using
<code>operator==</code> to compare the value types).
</para>
</description>
<notes>
<para><emphasis>TODO</emphasis>: Documentation outdated.</para>
<para>This is a boost extension.</para>
<para>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
<code>BOOST_UNORDERED_DEPRECATED_EQUALITY</code>.</para>
<para>Behavior is undefined if the two containers don't have
equivalent equality predicates.</para>
</notes>
@ -1784,9 +1814,19 @@ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
<paramtype>unordered_multiset&lt;Value, Hash, Pred, Alloc&gt; const&amp;</paramtype>
</parameter>
<type>bool</type>
<description>
<para>Return <code>false</code> if <code>x.size() ==
y.size</code> and for every equivalent key group in
<code>x</code>, there is a group in <code>y</code>
for the same key, which is a permutation (using
<code>operator==</code> to compare the value types).
</para>
</description>
<notes>
<para><emphasis>TODO</emphasis>: Documentation outdated.</para>
<para>This is a boost extension.</para>
<para>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
<code>BOOST_UNORDERED_DEPRECATED_EQUALITY</code>.</para>
<para>Behavior is undefined if the two containers don't have
equivalent equality predicates.</para>
</notes>
@ -2722,9 +2762,19 @@ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
<paramtype>unordered_map&lt;Key, Mapped, Hash, Pred, Alloc&gt; const&amp;</paramtype>
</parameter>
<type>bool</type>
<description>
<para>Return <code>true</code> if <code>x.size() ==
y.size</code> and for every element in <code>x</code>,
there is an element in <code>y</code> with the same
for the same key, with an equal value (using
<code>operator==</code> to compare the value types).
</para>
</description>
<notes>
<para><emphasis>TODO</emphasis>: Documentation outdated.</para>
<para>This is a boost extension.</para>
<para>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
<code>BOOST_UNORDERED_DEPRECATED_EQUALITY</code>.</para>
<para>Behavior is undefined if the two containers don't have
equivalent equality predicates.</para>
</notes>
@ -2749,9 +2799,19 @@ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
<paramtype>unordered_map&lt;Key, Mapped, Hash, Pred, Alloc&gt; const&amp;</paramtype>
</parameter>
<type>bool</type>
<description>
<para>Return <code>false</code> if <code>x.size() ==
y.size</code> and for every element in <code>x</code>,
there is an element in <code>y</code> with the same
for the same key, with an equal value (using
<code>operator==</code> to compare the value types).
</para>
</description>
<notes>
<para><emphasis>TODO</emphasis>: Documentation outdated.</para>
<para>This is a boost extension.</para>
<para>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
<code>BOOST_UNORDERED_DEPRECATED_EQUALITY</code>.</para>
<para>Behavior is undefined if the two containers don't have
equivalent equality predicates.</para>
</notes>
@ -3648,9 +3708,19 @@ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
<paramtype>unordered_multimap&lt;Key, Mapped, Hash, Pred, Alloc&gt; const&amp;</paramtype>
</parameter>
<type>bool</type>
<description>
<para>Return <code>true</code> if <code>x.size() ==
y.size</code> and for every equivalent key group in
<code>x</code>, there is a group in <code>y</code>
for the same key, which is a permutation (using
<code>operator==</code> to compare the value types).
</para>
</description>
<notes>
<para><emphasis>TODO</emphasis>: Documentation outdated.</para>
<para>This is a boost extension.</para>
<para>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
<code>BOOST_UNORDERED_DEPRECATED_EQUALITY</code>.</para>
<para>Behavior is undefined if the two containers don't have
equivalent equality predicates.</para>
</notes>
@ -3675,9 +3745,19 @@ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
<paramtype>unordered_multimap&lt;Key, Mapped, Hash, Pred, Alloc&gt; const&amp;</paramtype>
</parameter>
<type>bool</type>
<description>
<para>Return <code>false</code> if <code>x.size() ==
y.size</code> and for every equivalent key group in
<code>x</code>, there is a group in <code>y</code>
for the same key, which is a permutation (using
<code>operator==</code> to compare the value types).
</para>
</description>
<notes>
<para><emphasis>TODO</emphasis>: Documentation outdated.</para>
<para>This is a boost extension.</para>
<para>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
<code>BOOST_UNORDERED_DEPRECATED_EQUALITY</code>.</para>
<para>Behavior is undefined if the two containers don't have
equivalent equality predicates.</para>
</notes>