Difference between revisions of "cpp/named req/AssociativeContainer"
From cppreference.com
D41D8CD98F (Talk | contribs) m (→Requirements) |
(refreshed the legend from n4606, not yet table contents) |
||
Line 8: | Line 8: | ||
{{dsc h1|Legend}} | {{dsc h1|Legend}} | ||
{{dsc|{{ttb|X}}|Container type}} | {{dsc|{{ttb|X}}|Container type}} | ||
− | {{dsc|{{ttb|a}}| | + | {{dsc|{{ttb|a}}|Value of type {{ttb|X}}}} |
− | {{dsc|{{ttb|a_uniq}}| | + | {{dsc|{{ttb|a2}}|Value of a type {{ttb|Y}} whose [[cpp/container/node handle|node handles]] are compatible with X}} |
− | {{dsc|{{ttb|a_eq}}| | + | {{dsc|{{ttb|b}}|Possibly const value of type {{ttb|X}}}} |
− | {{dsc|{{ttb| | + | {{dsc|{{ttb|u}}|Arbitrary variable name}} |
− | {{dsc|{{ttb|i}}, {{ttb|j}}|{{concept|InputIterator}}s denoting a valid range}} | + | {{dsc|{{ttb|a_uniq}}|Value of type {{ttb|X}} when {{ttb|X}} supports unique keys}} |
− | {{dsc|{{ttb|p}}| | + | {{dsc|{{ttb|a_eq}}|Value of type {{ttb|X}} when {{ttb|X}} supports multiple keys}} |
− | {{dsc|{{ttb|q}}|dereferenceable | + | {{dsc|{{ttb|a_tran}}|Possibly const value of type {{ttb|X}} when type {{tt|X::key_compare::is_transparent}} exists}} |
− | {{dsc|{{ttb|q1}}, {{ttb|q2}}| | + | {{dsc|{{ttb|i}}, {{ttb|j}}|{{concept|InputIterator}}s denoting a valid range and referring to elements implicitly convertible to {{tt|X::value_type}}}} |
− | {{dsc|{{ttb|il}}|{{lc|std::initializer_list}}<value_type>}} | + | {{dsc|{{ttb|p}}|A valid const iterator to {{ttb|a}} }} |
− | {{dsc|{{ttb|t}}| | + | {{dsc|{{ttb|q}}|A valid dereferenceable const iterator to {{ttb|a}} }} |
− | {{dsc|{{ttb|k}}| | + | {{dsc|{{ttb|r}}|A valid dereferenceable iterator to {{ttb|a}} }} |
− | {{dsc|{{ttb|c}}| | + | {{dsc|{{ttb|q1}}, {{ttb|q2}}|const iterators denoting a valid range in {{ttb|a}} }} |
+ | {{dsc|{{ttb|il}}|An object of type {{lc|std::initializer_list}}<value_type>}} | ||
+ | {{dsc|{{ttb|t}}|A value of type {{ttb|X::value_type}} }} | ||
+ | {{dsc|{{ttb|k}}|A value of type {{ttb|X::key_type}} }} | ||
+ | {{dsc|{{ttb|c}}|A possibly const value of type {{ttb|X::key_compare}} }} | ||
+ | {{dsc|{{ttb|kl}}|A value such that {{ttb|a}} is partitioned with respect to {{c|c(r,kl)}}, with {{tt|r}} the key value of {{tt|e}} and {{tt|e}} in {{tt|a}}}} | ||
+ | {{dsc|{{ttb|ku}}|A value such that {[ttb|a}} is partitioned with respect to {c|!c(ku, r)}}}} | ||
+ | {{dsc|{{ttb|ke}}|A value such that {{ttb|a}} is partitioned with respect to {{c|c(r, ke)}} and {{c|!c(ke, r)}}, with {{c|c(r, ke)}} implying {{c|!c(ke, r)}}}} | ||
{{dsc|{{ttb|A}}|Storage allocator used by {{ttb|X}}, or {{lc|std::allocator_type<X::value_type>}} }} | {{dsc|{{ttb|A}}|Storage allocator used by {{ttb|X}}, or {{lc|std::allocator_type<X::value_type>}} }} | ||
{{dsc|{{ttb|m}}|Allocator of a type convertible to {{ttb|A}} }} | {{dsc|{{ttb|m}}|Allocator of a type convertible to {{ttb|A}} }} | ||
+ | {{dsc|{{ttb|nh}}|A non-const rvalue of type {{tt|X::node_type}} | ||
{{dsc end}} | {{dsc end}} | ||
Revision as of 13:44, 19 July 2016
Template:cpp/concept/title Template:cpp/concept/navbar
An AssociativeContainer
is an ordered Template:concept that provides fast lookup of objects based on keys.
Requirements
Legend | |
X
|
Container type |
a
|
Value of type X
|
a2
|
Value of a type Y whose node handles are compatible with X
|
b
|
Possibly const value of type X
|
u
|
Arbitrary variable name |
a_uniq
|
Value of type X when X supports unique keys
|
a_eq
|
Value of type X when X supports multiple keys
|
a_tran
|
Possibly const value of type X when type X::key_compare::is_transparent exists
|
i , j
|
Template:concepts denoting a valid range and referring to elements implicitly convertible to X::value_type
|
p
|
A valid const iterator to a
|
q
|
A valid dereferenceable const iterator to a
|
r
|
A valid dereferenceable iterator to a
|
q1 , q2
|
const iterators denoting a valid range in a
|
il
|
An object of type std::initializer_list<value_type> |
t
|
A value of type X::value_type
|
k
|
A value of type X::key_type
|
c
|
A possibly const value of type X::key_compare
|
kl
|
A value such that a is partitioned with respect to c(r,kl), with r the key value of e and e in a
|
ku
|
A value such that {[ttb |
ke
|
A value such that a is partitioned with respect to c(r, ke) and !c(ke, r), with c(r, ke) implying !c(ke, r)
|
A
|
Storage allocator used by X , or std::allocator_type<X::value_type>
|
m
|
Allocator of a type convertible to A
|
expression | return type | pre/requirements | post/effects | complexity |
---|---|---|---|---|
X::key_type | Key |
Key is Template:concept |
compile time | |
X::key_compare | Compare |
compile time | ||
X::value_compare | a type satisfying Template:concept | key_compare for std::set and std::multiset; an ordering relation over Key for std::map and std::multimap |
compile time | |
X(c), X a(c); | key_compare is Template:concept | Construct an empty container using a copy of c as key_comp |
constant | |
X(), X a; | key_compare is Template:concept | Construct an empty container using a Compare() as key_comp |
constant | |
X(i, j, c), X a(i, j, c); | key_compare is Template:concept and value_type is Template:concept into X from *i | Constructs an empty container using a copy of c as key_comp and inserts all elements from the range [i; j) |
generally N log N , or N if [i, j) is sorted (where N is std::distance(i, j))
| |
X(i, j), X a(i, j); | key_compare is Template:concept and value_type is Template:concept into X from *i | Constructs an empty container using a Compare() as key_comp and inserts all elements from the range [i; j) |
generally N log N , or N if [i, j) is sorted according to value_comp() (where N is std::distance(i, j))
| |
X(il); | Equivalent to X(il.begin(), il.end()); | Equivalent to X(il.begin(), il.end()); | ||
a = il | X& | T is Template:concept into X and also Template:concept |
Assign the range [il.begin(), il.end()) into a . Elements of a that were not assigned to are destroyed |
generally N log N , or N if [il.begin(), il.end()) is sorted according to value_comp() (where N is il.size() + a.size())
|
a.key_comp() | X::key_compare | The comparison object with which a was constructed is returned. |
constant | |
a.value_comp() | X::value_compare | An object of type X::value_compare constructed out of the comparison object is returned. | constant |
An AssociativeContainer X
that is either std::map
and std::multimap
additionally supports the expression X::mapped_type, which has a return type of T, with the requirement that T
be Template:concept, and compile time complexity.
This section is incomplete Reason: Finish requirements. |
AssociativeContainers in the standard library
collection of unique keys, sorted by keys (class template) | |
collection of keys, sorted by keys (class template) | |
collection of key-value pairs, sorted by keys, keys are unique (class template) | |
collection of key-value pairs, sorted by keys (class template) |