libstdc++
Sequences
Collaboration diagram for Sequences:

Classes

struct  std::array< _Tp, _Nm >
 
class  std::basic_string< _CharT, _Traits, _Alloc >
 
class  std::basic_string_view< _CharT, _Traits >
 
class  std::experimental::fundamentals_v1::basic_string_view< _CharT, _Traits >
 
class  std::deque< _Tp, _Alloc >
 
class  std::forward_list< _Tp, _Alloc >
 
class  std::list< _Tp, _Alloc >
 
class  std::priority_queue< _Tp, _Sequence, _Compare >
 
class  std::queue< _Tp, _Sequence >
 
class  std::stack< _Tp, _Sequence >
 
class  std::vector< _Tp, _Alloc >
 
class  std::vector< bool, _Alloc >
 

Detailed Description

Sequences arrange a collection of objects into a strictly linear order.

The differences between sequences are usually due to one or both of the following:

As an example of the first case, vector is required to use a contiguous memory layout, while other sequences such as deque are not.

The prime reason for choosing one sequence over another should be based on the second category of differences, algorithmic complexity. For example, if you need to perform many inserts and removals from the middle of a sequence, list would be ideal. But if you need to perform constant-time access to random elements of the sequence, then list should not be used.

All sequences must meet certain requirements, summarized in tables.