Expression | Return type | Assertion/note | Complexity |
pre-/post-condition | |||
Key | compile time | ||
T | compile time | ||
Key | Preconditions: value_type is Cpp17Erasable from X | compile time | |
X::value_type (unordered_map and unordered_multimap only) | pair<const Key, T> | Preconditions: value_type is Cpp17Erasable from X | compile time |
Hash | Preconditions: Hash is a unary function object type such that the expression
hf(k) has type size_t. | compile time | |
Pred | Pred is an equivalence relation. | compile time | |
An iterator type whose category, value type,
difference type, and pointer and reference types are the same as
X::iterator's. | A local_iterator object may be used to iterate through a
single bucket, but may not be used to iterate across
buckets. | compile time | |
An iterator type whose category, value type,
difference type, and pointer and reference types are the same as
X::const_iterator's. | A const_local_iterator object may be used to iterate through a
single bucket, but may not be used to iterate across
buckets. | compile time | |
a specialization of a node-handle
class template, such that the public nested types are
the same types as the corresponding types in X. | see [container.node] | compile time | |
X | Effects: Constructs an empty container with at least n buckets,
using hf as the hash function and eq as the key
equality predicate. | ||
X(n, hf) X a(n, hf); | X | Effects: Constructs an empty container with at least n buckets, using hf as the hash function and key_equal() as the key equality predicate. | |
X(n) X a(n); | X | Effects: Constructs an empty container with at least n buckets, using hasher() as the hash function and key_equal() as the key equality predicate. | |
X() X a; | X | Effects: Constructs an empty container with an unspecified number of buckets, using hasher() as the hash function and key_equal() as the key equality predicate. | constant |
X(i, j, n, hf, eq) X a(i, j, n, hf, eq); | X | Effects: Constructs an empty container with at least n buckets, using hf as the hash function and eq as the key equality predicate, and inserts elements from [i, j) into it. | Average case (N is distance(i, j)), worst case
|
X(i, j, n, hf) X a(i, j, n, hf); | X | Effects: Constructs an empty container with at least n buckets, using hf as the hash function and key_equal() as the key equality predicate, and inserts elements from [i, j) into it. | Average case (N is distance(i, j)), worst case
|
X(i, j, n) X a(i, j, n); | X | Effects: Constructs an empty container with at least n buckets, using hasher() as the hash function and key_equal() as the key equality predicate, and inserts elements from [i, j) into it. | Average case (N is distance(i, j)), worst case
|
X(i, j) X a(i, j); | X | Effects: Constructs an empty container with an unspecified number of buckets, using hasher() as the hash function and key_equal() as the key equality predicate, and inserts elements from [i, j) into it. | Average case (N is distance(i, j)), worst case
|
X(il) | X | Same as X(il.begin(), il.end()). | |
X(il, n) | X | Same as X(il.begin(), il.end(), n). | |
X(il, n, hf) | X | Same as X(il.begin(), il.end(), n, hf). | |
X(il, n, hf, eq) | X | Same as X(il.begin(), il.end(), n, hf, eq). | |
X(b) X a(b); | X | Copy constructor. | Average case linear in b.size(), worst case quadratic. |
a = b | X& | Copy assignment operator. | Average case linear in b.size(), worst case quadratic. |
a = il | X& | All
existing elements of a are either assigned to or destroyed. | Same as a = X(il). |
hasher | constant | ||
key_equal | constant | ||
pair<iterator, bool> | Effects: Inserts a value_type object t constructed with std::forward<Args>(args)... if and only if there is no element in the container with key equivalent to the key of t. The bool component of the returned
pair is true if and only if the insertion takes place, and the iterator
component of the pair points to the element with key equivalent to the
key of t. | ||
a_eq.emplace(args) | iterator | Effects: Inserts a value_type object t constructed with std::forward<Args>(args)... and returns the iterator pointing to the newly inserted element. | |
iterator | Return value is an iterator pointing to the element with the key equivalent
to the newly inserted element. Implementations are
permitted to ignore the hint. | ||
pair<iterator, bool> | Preconditions: If t is a non-const rvalue, value_type is
Cpp17MoveInsertable into X; otherwise, value_type is
Cpp17CopyInsertable into X. Effects: Inserts t if and only if there is no element in the container with key equivalent to the key of t. The bool
component of the returned pair indicates whether the insertion
takes place, and the iterator component points to the element
with key equivalent to the key of t. | ||
a_eq.insert(t) | iterator | Preconditions: If t is a non-const rvalue, value_type is
Cpp17MoveInsertable into X; otherwise, value_type is
Cpp17CopyInsertable into X. | |
a.insert(p, t) | iterator | Preconditions: If t is a non-const rvalue, value_type is
Cpp17MoveInsertable into X; otherwise, value_type is
Cpp17CopyInsertable into X. Return value is an iterator pointing
to the element with the key equivalent to that of t. The
iterator p is a hint pointing to where the search should
start. Implementations are permitted to ignore the hint. | |
a.insert(i, j) | void | ||
a.insert(il) | void | Same as a.insert(il.begin(), il.end()). | |
a_uniq. insert(nh) | insert_return_type | Otherwise, inserts the
element owned by nh if and only if there is no element in the
container with a key equivalent to nh.key(). Otherwise if the insertion took place, inserted is true,
position points to the inserted element, and node is empty;
if the insertion failed, inserted is false,
node has the previous value of nh, and position
points to an element with a key equivalent to nh.key(). | |
a_eq. insert(nh) | iterator | Otherwise, inserts the element owned by nh and returns an iterator
pointing to the newly inserted element. | |
a.insert(q, nh) | iterator | Otherwise, inserts the element owned by nh if and only if there
is no element with key equivalent to nh.key() in containers with
unique keys; always inserts the element owned by nh in containers
with equivalent keys. Always returns the iterator pointing to the element
with key equivalent to nh.key(). The iterator q is a hint
pointing to where the search should start. Implementations are permitted
to ignore the hint. | |
node_type | |||
a.extract(q) | node_type | ||
void | Attempts to extract each element in a2 and insert it into a using the hash function and key equality predicate of a. In containers with unique keys, if there is an element in a with
key equivalent to the key of an element from a2, then that
element is not extracted from a2.
Postconditions: Pointers and references to the transferred elements of a2
refer to those same elements but as members of a. Iterators referring
to the transferred elements and all iterators referring to a will
be invalidated, but iterators to elements remaining in a2 will
remain valid. | ||
size_type | |||
a.erase(q) | iterator | ||
a.erase(r) | iterator | ||
a.erase(q1, q2) | iterator | ||
void | Effects: Erases all elements in the container. Postconditions: a.empty() is true | Linear in a.size(). | |
Returns: An iterator pointing to an element with key equivalent to
k, or b.end() if no such element exists. | |||
a_tran.find(ke) | Returns: An iterator pointing to an element with key equivalent to
ke, or a_tran.end() if no such element exists. | ||
size_type | |||
a_tran.count(ke) | size_type | ||
bool | Effects: Equivalent to b.find(k) != b.end() | ||
a_tran.contains(ke) | bool | Effects: Equivalent to a_tran.find(ke) != a_tran.end() | |
Returns make_pair(b.end(), b.end()) if
no such elements exist. | |||
a_tran.equal_range(ke) | Returns make_pair(a_tran.end(), a_tran.end()) if
no such elements exist. | ||
size_type | Constant | ||
size_type | Constant | ||
size_type | Returns: The index of the bucket in which elements with keys equivalent to k would be found, if any such element existed. | Constant | |
size_type | |||
If the bucket is empty, then
b.begin(n) == b.end(n). | Constant | ||
Constant | |||
const_local_iterator | If the bucket is empty, then
b.cbegin(n) == b.cend(n). | Constant | |
const_local_iterator | Returns: An iterator which is the past-the-end
value for the bucket. | Constant | |
float | Returns: The average number of elements per bucket. | Constant | |
float | Returns: A positive number that the container attempts to keep the load factor
less than or equal to. The container automatically increases the
number of buckets as necessary to keep the load factor below this
number. | Constant | |
a.max_load_factor(z) | void | May change the container's maximum load factor, using z as a hint. | Constant |
void | Average case linear in a.size(), worst case quadratic. | ||
void | Average case linear in a.size(), worst case quadratic. |