Skip to content

Commit

Permalink
LWG1214
Browse files Browse the repository at this point in the history
sdutoit committed Feb 26, 2012
1 parent 09fcc1d commit 682fcba
Showing 1 changed file with 24 additions and 7 deletions.
31 changes: 24 additions & 7 deletions source/containers.tex
Original file line number Diff line number Diff line change
@@ -1128,7 +1128,7 @@
\tcode{map}
and
\tcode{multimap}
associate an arbitrary type
associate an arbitrary \term{mapped type}
\tcode{T}
with the
\tcode{Key}.
@@ -1173,7 +1173,6 @@
\pnum
For \tcode{set} and \tcode{multiset} the value type is the same as the key type.
For \tcode{map} and \tcode{multimap} it is equal to \tcode{pair<const Key, T>}.
Keys in an associative container are immutable.

\pnum
\tcode{iterator}
@@ -1556,20 +1555,27 @@
\pnum
\indextext{unordered associative containers!hash function}%
\indextext{hash function}%
A hash function is a function object that takes a single argument
of type \tcode{Key} and returns a value of type \tcode{std::size_t}.
The container's object of type \tcode{Hash} --- denoted by
\tcode{hash} --- is called the \term{hash function} of the
container. The container's object of type \tcode{Pred} ---
denoted by \tcode{pred} --- is called the
\term{key equality predicate} of the container.

\pnum
\indextext{unordered associative containers!equality function}%
Two values \tcode{k1} and \tcode{k2} of type \tcode{Key} are
considered equivalent if the container's
\tcode{key_equal} function object returns
key equality predicate returns
\tcode{true} when passed those values. If \tcode{k1} and
\tcode{k2} are equivalent, the hash function shall return the same value
for both.
\tcode{k2} are equivalent, the container's hash function shall
return the same value for both.
\enternote Thus, when an unordered associative container is instantiated with
a non-default \tcode{Pred} parameter it usually needs a non-default \tcode{Hash}
parameter as well. \exitnote
For any two keys \tcode{k1} and \tcode{k2} in the same container,
calling \tcode{pred(k1, k2)} shall always return the same value.
For any key \tcode{k} in a container, calling \tcode{hash(k)}
shall always return the same value.

\pnum
\indextext{unordered associative containers!unique keys}%
@@ -1593,6 +1599,17 @@
\tcode{unordered_multimap} it is \tcode{std::pair<const Key,
T>}.

\pnum
For unordered containers where the value type is the same as the key
type, both \tcode{iterator} and \tcode{const_iterator} are constant
iterators. It is unspecified whether or not \tcode{iterator} and
\tcode{const_iterator} are the same type.
\enternote \tcode{iterator} and \tcode{const_iterator} have identical
semantics in this case, and \tcode{iterator} is convertible to
\tcode{const_iterator}. Users can avoid violating the One Definition Rule
by always using \tcode{const_iterator} in their function parameter lists.
\exitnote

\pnum
\indextext{buckets}%
\indextext{hash code}%

0 comments on commit 682fcba

Please sign in to comment.