Expression | Return type | Operational | Assertion/note | Complexity | |
semantics | pre-/post-condition | ||||
X::value_type | T | compile time | |||
X::reference | T& | compile time | |||
X::const_reference | const T& | compile time | |||
X::iterator | iterator type whose value type is T | compile time | |||
X::const_iterator | constant iterator type whose value type is T | any iterator category
that meets the forward iterator requirements. | compile time | ||
X::difference_type | signed integer type | is identical to the difference type of X::iterator and X::const_iterator | compile time | ||
X::size_type | unsigned integer type | size_type can represent any non-negative value of difference_type | compile time | ||
X u; | Postconditions: u.empty() | constant | |||
X() | Postconditions: X().empty() | constant | |||
X(a) | linear | ||||
X u(a); X u = a; | Postconditions: u == a | linear | |||
X u(rv); X u = rv; | Postconditions: u is equal to the value that rv had before this construction | (Note B) | |||
a = rv | X& | All existing elements of a are either move assigned to or destroyed | Postconditions: a is equal to the value that rv
had before this assignment | linear | |
a.~X() | void | Effects: destroys every element of a; any memory obtained is deallocated. | linear | ||
a.begin() | iterator; const_iterator for constant a | constant | |||
a.end() | iterator; const_iterator for constant a | constant | |||
a.cbegin() | const_iterator | const_cast<X const&>(a).begin(); | constant | ||
a.cend() | const_iterator | const_cast<X const&>(a).end(); | constant | ||
i <=> j | strong_ordering | Constraints: X::iterator meets the random access iterator requirements. | constant | ||
a == b | convertible to bool | == is an equivalence relation. equal(a.begin(), a.end(), b.begin(), b.end()) | Preconditions: T meets the Cpp17EqualityComparable requirements | Constant if a.size() != b.size(),
linear otherwise | |
a != b | convertible to bool | Equivalent to !(a == b) | linear | ||
a.swap(b) | void | Effects: exchanges the contents of a and b | (Note A) | ||
swap(a, b) | void | Equivalent to a.swap(b) | (Note A) | ||
r = a | X& | Postconditions: r == a. | linear | ||
a.size() | size_type | distance(a.begin(), a.end()) | constant | ||
a.max_size() | size_type | distance(begin(), end())
for the largest possible container | constant | ||
a.empty() | convertible to bool | a.begin() == a.end() | constant |