Category: containers
Component type: concept
A Front Access Container LOGN is a Forward Container where it is possible to access, pop or destroy the first element, in amortized logn time. Front Access Containers have special member functions as a shorthand for those operations.
A Front Access Container LOGN is the same as a Front Access Container except that the performance requirements have changed to logn time.
None, except for those of Forward Container.
X | A type that is a model of Front Access Container |
a | Object of type X |
In addition to the expressions defined in Forward Container, the following expressions must be valid.
Name | Expression | Type requirements | Return type |
---|---|---|---|
Front | a.front() | reference if a is mutable, otherwise const_reference . | |
Pop front | a.pop_front() | a is mutable. | void |
Destroy front | a.destroy_front() | a is mutable. | void |
Name | Expression | Precondition | Semantics | Postcondition |
---|---|---|---|---|
Front | a.front() [1] | !a.empty() | Equivalent to *(a.begin()) . | |
Pop front | a.pop_front() | !a.empty() | Equivalent to a.erase(a.begin()) | a.size() is decremented by 1. |
Destroy front | a.destroy_front() | !a.empty() | Equivalent to delete *(a.begin()); a.erase(a.begin()); | a.size() is decremented by 1. |
Front, pop front and destroy front are amortized logn time. [2]
[1] This complexity guarantee is the only reason that front()
, pop_front()
and destroy_front()
are defined: they provide no additional functionality. Not every sequence must define these operations, but it is guaranteed that they are efficient if they exist at all.
Container, Forward Container, Front Access Container, Back Access Container, Back Access Container LOGN.