Category: containers
Component type: concept
A Back Insertion Sequence is a Sequence where it is possible to append an element to the end, or to access the last element, in amortized constant time. Back Insertion Sequences have special member functions as a shorthand for those operations.
Sequence
None, except for those of Sequence.
X
A type that is a model of Back Insertion Sequence
a
Object of type
T
The value type of
t
Object of type
In addition to the expressions defined in Sequence, the following expressions must be valid.
Name | Expression | Type requirements | Return type |
---|---|---|---|
Back | a.back() | ||
Push back | a.push_back(t) | void | |
Pop back | a.pop_back() | void |
Name | Expression | Precondition | Semantics | Postcondition |
---|---|---|---|---|
Back | a.back() | !a.empty() | Equivalent to | |
Push back | a.push_back(t) | Equivalent to | ||
Pop back | a.pop_back() | !a.empty() | Equivalent to |
Back, push back, and pop back are amortized constant time. [1]
Symmetry of push and pop |
vector
list
deque
[1] This complexity guarantee is the only reason that
Container, Sequence, Front Insertion Sequence,