Showing content from https://timsong-cpp.github.io/cppwp/n4659/unord.req below:
[unord.req]
Expression Return type Assertion/note Complexity pre-/post-condition X::key_type Key compile time X::mapped_type (unordered_map and unordered_multimap only) T compile time X::value_type (unordered_set and unordered_multiset only) Key Requires: value_type is Erasable from X compile time X::value_type (unordered_map and unordered_multimap only) pair<const Key, T> Requires: value_type is Erasable from X compile time X::hasher Hash Hash shall be a unary function object type such that the expression hf(k) has type size_t. compile time X::key_equal Pred Requires: Pred is CopyConstructible.
Pred shall be a binary predicate that takes two arguments of type Key. Pred is an equivalence relation. compile time X::local_iterator 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 X::const_local_iterator 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 X::node_type 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(n, hf, eq)
X a(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. O(n) X(n, hf)
X a(n, hf); X Requires: key_equal is DefaultConstructible.
Effects: Constructs an empty container with at least n buckets, using hf as the hash function and key_equal() as the key equality predicate. O(n) X(n)
X a(n); X Requires: hasher and key_equal are DefaultConstructible.
Effects: Constructs an empty container with at least n buckets, using hasher() as the hash function and key_equal() as the key equality predicate. O(n) X()
X a; X Requires: hasher and key_equal are DefaultConstructible.
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 Requires: value_type is EmplaceConstructible into X from *i.
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 O(N) (N is distance(i, j)), worst case O(N2) X(i, j, n, hf)
X a(i, j, n, hf); X Requires: key_equal is DefaultConstructible. value_type is EmplaceConstructible into X from *i.
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 O(N) (N is distance(i, j)), worst case O(N2) X(i, j, n)
X a(i, j, n); X Requires: hasher and key_equal are DefaultConstructible. value_type is EmplaceConstructible into X from *i.
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 O(N) (N is distance(i, j)), worst case O(N2) X(i, j)
X a(i, j); X Requires: hasher and key_equal are DefaultConstructible. value_type is EmplaceConstructible into X from *i.
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 O(N) (N is distance(i, j)), worst case O(N2) X(il) X Same as X(il.begin(), il.end()). Same as X(il.begin(), il.end()). X(il, n) X Same as X(il.begin(), il.end(), n). Same as X(il.begin(), il.end(), n). X(il, n, hf) X Same as X(il.begin(), il.end(), n, hf). 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). Same as X(il.begin(), il.end(), n, hf, eq). X(b)
X a(b); X Copy constructor. In addition to the requirements of Table 83, copies the hash function, predicate, and maximum load factor. Average case linear in b.size(), worst case quadratic. a = b X& Copy assignment operator. In addition to the requirements of Table 83, copies the hash function, predicate, and maximum load factor. Average case linear in b.size(), worst case quadratic. a = il X& Requires: value_type is CopyInsertable into X and CopyAssignable.
Effects: Assigns the range [il.begin(), il.end()) into a. All existing elements of a are either assigned to or destroyed. Same as a = X(il). b.hash_function() hasher Returns b's hash function. constant b.key_eq() key_equal Returns b's key equality predicate. constant a_uniq. emplace(args) pair<iterator, bool> Requires: value_type shall be EmplaceConstructible into X from args.
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. Average case O(1), worst case O(a_uniq.size()). a_eq.emplace(args) iterator Requires: value_type shall be EmplaceConstructible into X from args.
Effects: Inserts a value_type object t constructed with std::forward<Args>(args)... and returns the iterator pointing to the newly inserted element. Average case O(1), worst case O(a_eq.size()). a.emplace_hint(p, args) iterator Requires: value_type shall be EmplaceConstructible into X from args.
Effects: Equivalent to a.emplace( std::forward<Args>(args)...). Return value is an iterator pointing to the element with the key equivalent to the newly inserted element. The const_iterator p is a hint pointing to where the search should start. Implementations are permitted to ignore the hint. Average case O(1), worst case O(a.size()). a_uniq.insert(t) pair<iterator, bool> Requires: If t is a non-const rvalue expression, value_type shall be MoveInsertable into X; otherwise, value_type shall be CopyInsertable 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. Average case O(1), worst case O(a_uniq.size()). a_eq.insert(t) iterator Requires: If t is a non-const rvalue expression, value_type shall be MoveInsertable into X; otherwise, value_type shall be CopyInsertable into X.
Effects: Inserts t, and returns an iterator pointing to the newly inserted element. Average case O(1), worst case O(a_eq.size()). a.insert(p, t) iterator Requires: If t is a non-const rvalue expression, value_type shall be MoveInsertable into X; otherwise, value_type shall be CopyInsertable into X.
Effects: Equivalent to a.insert(t). 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. Average case O(1), worst case O(a.size()). a.insert(i, j) void Requires: value_type shall be EmplaceConstructible into X from *i.
Requires: i and j are not iterators in a. Equivalent to a.insert(t) for each element in [i,j). Average case O(N), where N is distance(i, j). Worst case O(N(a.size()+1)). a.insert(il) void Same as a.insert(il.begin(), il.end()). Same as a.insert( il.begin(), il.end()). a_uniq.
insert(nh) insert_return_type Requires: nh is empty or a_uniq.get_allocator() == nh.get_allocator().
Effects: If nh is empty, has no effect. 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().
Postconditions: If nh is empty, inserted is false, position is end(), and node is empty. 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(). Average case O(1), worst case O(a_uniq.size()). a_eq.
insert(nh) iterator Requires: nh is empty or a_eq.get_allocator() == nh.get_allocator().
Effects: If nh is empty, has no effect and returns a_eq.end(). Otherwise, inserts the element owned by nh and returns an iterator pointing to the newly inserted element.
Postconditions: nh is empty. Average case O(1), worst case O(a_eq.size()). a.insert(q, nh) iterator Requires: nh is empty or a.get_allocator() == nh.get_allocator().
Effects: If nh is empty, has no effect and returns a.end(). 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.
Postconditions: nh is empty if insertion succeeds, unchanged if insertion fails. Average case O(1), worst case O(a.size()). a.extract(k) node_type Removes an element in the container with key equivalent to k. Returns a node_type owning the element if found, otherwise an empty node_type. Average case O(1), worst case O(a.size()). a.extract(q) node_type Removes the element pointed to by q. Returns a node_type owning that element. Average case O(1), worst case O(a.size()). a.merge(a2) void Requires: a.get_allocator() == a2.get_allocator().
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.
Throws: Nothing unless the hash function or key equality predicate throws. Average case O(N), where N is a2.size(). Worst case O(N*a.size()+N). a.erase(k) size_type Erases all elements with key equivalent to k. Returns the number of elements erased. Average case O(a.count(k)). Worst case O(a.size()). a.erase(q) iterator Erases the element pointed to by q. Returns the iterator immediately following q prior to the erasure. Average case O(1), worst case O(a.size()). a.erase(r) iterator Erases the element pointed to by r. Returns the iterator immediately following r prior to the erasure. Average case O(1), worst case O(a.size()). a.erase(q1, q2) iterator Erases all elements in the range [q1, q2). Returns the iterator immediately following the erased elements prior to the erasure. Average case linear in distance(q1, q2), worst case O(a.size()). a.clear() void Erases all elements in the container. Postconditions: a.empty() returns true Linear in a.size(). b.find(k) iterator;
const_iterator for const b. Returns an iterator pointing to an element with key equivalent to k, or b.end() if no such element exists. Average case O(1), worst case O(b.size()). b.count(k) size_type Returns the number of elements with key equivalent to k. Average case O(b.count(k)), worst case O(b.size()). b.equal_range(k) pair<iterator, iterator>;
pair<const_iterator, const_iterator> for const b. Returns a range containing all elements with keys equivalent to k. Returns make_pair(b.end(), b.end()) if no such elements exist. Average case O(b.count(k)). Worst case O(b.size()). b.bucket_count() size_type Returns the number of buckets that b contains. Constant b.max_bucket_count() size_type Returns an upper bound on the number of buckets that b might ever contain. Constant b.bucket(k) size_type Requires: b.bucket_count() > 0.
Returns the index of the bucket in which elements with keys equivalent to k would be found, if any such element existed. Postconditions: the return value shall be in the range [0, b.bucket_count()). Constant b.bucket_size(n) size_type Requires: n shall be in the range [0, b.bucket_count()). Returns the number of elements in the n th bucket. O(b.bucket_size(n)) b.begin(n) local_iterator;
const_local_iterator for const b. Requires: n shall be in the range [0, b.bucket_count()). b.begin(n) returns an iterator referring to the first element in the bucket. If the bucket is empty, then b.begin(n) == b.end(n). Constant b.end(n) local_iterator;
const_local_iterator for const b. Requires: n shall be in the range [0, b.bucket_count()). b.end(n) returns an iterator which is the past-the-end value for the bucket. Constant b.cbegin(n) const_local_iterator Requires: n shall be in the range [0, b.bucket_count()). Note: [b.cbegin(n), b.cend(n)) is a valid range containing all of the elements in the n th bucket. Constant b.cend(n) const_local_iterator Requires: n shall be in the range [0, b.bucket_count()). Constant b.load_factor() float Returns the average number of elements per bucket. Constant b.max_load_factor() 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 Requires: z shall be positive. May change the container's maximum load factor, using z as a hint. Constant a.rehash(n) void Postconditions: a.bucket_count() >= a.size() / a.max_load_factor() and a.bucket_count() >= n. Average case linear in a.size(), worst case quadratic. a.reserve(n) void Same as a.rehash(ceil(n / a.max_load_factor())). Average case linear in a.size(), worst case quadratic.
RetroSearch is an open source project built by @garambo
| Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4