Swap | a.swap(b) | void |
Semantics of an expression is defined only where it differs from, or is not defined in, Assignable, Equality Comparable, or LessThan Comparable
Name | Expression | Semantics | Postcondition |
---|---|---|---|
Copy constructor | X(a) | X().size() == a.size(). | |
Copy constructor | X b(a); | b.size() == a.size(). | |
Assignment operator | b = a | b.size() == a.size(). | |
Destructor | a.~X() | Each of | |
Beginning of range | a.begin() | Returns an iterator pointing to the first element in the container. [7] | |
End of range | a.end() | Returns an iterator pointing one past the last element in the container. | |
Size | a.size() | Returns the size of the container, that is, its number of elements. [8] | a.size() >= 0 && a.size() <= max_size() |
Maximum size | a.max_size() | Returns the largest size that this container can ever have. [8] | a.max_size() >= 0 && a.max_size() >= a.size() |
Empty container | a.empty() | Equivalent to | |
Swap | a.swap(b) | Equivalent to |
The copy constructor, the assignment operator, and the destructor are linear in the container's size.
Valid range | For any container |
Вы читаете Standard Template Library Programmer's Guide