library

Containers

Standard Containers
A container is a holder object that stores a collection of other objects (its elements). They are implemented as class templates, which allows a great flexibility in the types supported as elements.

The container manages the storage space for its elements and provides member functions to access them, either directly or through iterators (reference objects with similar properties to pointers).

Containers replicate structures very commonly used in programming: dynamic arrays (vector), queues (queue), stacks (stack), heaps (priority_queue), linked lists (list), trees (set), associative arrays (map)...

Many containers have several member functions in common, and share functionalities. The decision of which type of container to use for a specific need does not generally depend only on the functionality offered by the container, but also on the efficiency of some of its members (complexity). This is especially true for sequence containers, which offer different trade-offs in complexity between inserting/removing elements and accessing them.

stack, queue and priority_queue are implemented as container adaptors. Container adaptors are not full container classes, but classes that provide a specific interface relying on an object of one of the container classes (such as deque or list) to handle the elements. The underlying container is encapsulated in such a way that its elements are accessed by the members of the container adaptor independently of the underlying container class used.

Container class templates

Sequence containers:

Container adaptors:

Associative containers:

Unordered associative containers:

Other:
Two class templates share certain properties with containers, and are sometimes classified with them: bitset and valarray.

Member map

This is a comparison chart with the different member functions present on each of the different containers:

Legend:
C++98Available since C++98
C++11New in C++11

Sequence containers

Headers<array><vector><deque><forward_list><list>
Membersarrayvectordequeforward_listlist
constructorimplicitvectordequeforward_listlist
destructorimplicit~vector~deque~forward_list~list
operator=implicitoperator=operator=operator=operator=
iteratorsbeginbeginbeginbeginbegin
before_begin
begin
endendendendendend
rbeginrbeginrbeginrbegin rbegin
rendrendrendrend rend
const iteratorscbegincbegincbegincbegincbegin
cbefore_begin
cbegin
cendcendcendcendcendcend
crbegincrbegincrbegincrbegin crbegin
crendcrendcrendcrend crend
capacitysizesizesizesize size
max_sizemax_sizemax_sizemax_sizemax_sizemax_size
emptyemptyemptyemptyemptyempty
resize resizeresizeresizeresize
shrink_to_fit shrink_to_fitshrink_to_fit
capacity capacity
reserve reserve
element accessfrontfrontfrontfrontfrontfront
backbackbackback back
operator[]operator[]operator[]operator[]
atatatat
modifiersassign assignassignassignassign
emplace emplaceemplaceemplace_afteremplace
insert insertinsertinsert_afterinsert
erase eraseeraseerase_aftererase
emplace_back emplace_backemplace_back emplace_back
push_back push_backpush_back push_back
pop_back pop_backpop_back pop_back
emplace_front emplace_frontemplace_frontemplace_front
push_front push_frontpush_frontpush_front
pop_front pop_frontpop_frontpop_front
clear clearclearclearclear
swapswapswapswapswapswap
list operationssplice splice_aftersplice
remove removeremove
remove_if remove_ifremove_if
unique uniqueunique
merge mergemerge
sort sortsort
reverse reversereverse
observersget_allocator get_allocatorget_allocatorget_allocatorget_allocator
datadatadata

Associative containers

Headers<set><map><unordered_set><unordered_map>
Memberssetmultisetmapmultimapunordered_setunordered_multisetunordered_mapunordered_multimap
constructorsetmultisetmapmultimapunordered_setunordered_multisetunordered_mapunordered_multimap
destructor~set~multiset~map~multimap~unordered_set~unordered_multiset~unordered_map~unordered_multimap
assignmentoperator=operator=operator=operator=operator=operator=operator=operator=
iteratorsbeginbeginbeginbeginbeginbeginbeginbeginbegin
endendendendendendendendend
rbeginrbeginrbeginrbeginrbegin
rendrendrendrendrend
const iteratorscbegincbegincbegincbegincbegincbegincbegincbegincbegin
cendcendcendcendcendcendcendcendcend
crbegincrbegincrbegincrbegincrbegin
crendcrendcrendcrendcrend
capacitysizesizesizesizesizesizesizesizesize
max_sizemax_sizemax_sizemax_sizemax_sizemax_sizemax_sizemax_sizemax_size
emptyemptyemptyemptyemptyemptyemptyemptyempty
reserve reservereservereservereserve
element accessat at at
operator[] operator[] operator[]
modifiersemplaceemplaceemplaceemplaceemplaceemplaceemplaceemplaceemplace
emplace_hintemplace_hintemplace_hintemplace_hintemplace_hintemplace_hintemplace_hintemplace_hintemplace_hint
insertinsertinsertinsertinsertinsertinsertinsertinsert
eraseeraseeraseeraseeraseeraseeraseeraseerase
clearclearclearclearclearclearclearclearclear
swapswapswapswapswapswapswapswapswap
operationscountcountcountcountcountcountcountcountcount
findfindfindfindfindfindfindfindfind
equal_rangeequal_rangeequal_rangeequal_rangeequal_rangeequal_rangeequal_rangeequal_rangeequal_range
lower_boundlower_boundlower_boundlower_boundlower_bound
upper_boundupper_boundupper_boundupper_boundupper_bound
observersget_allocatorget_allocatorget_allocatorget_allocatorget_allocatorget_allocatorget_allocatorget_allocatorget_allocator
key_compkey_compkey_compkey_compkey_comp
value_compvalue_compvalue_compvalue_compvalue_comp
key_eq key_eqkey_eqkey_eqkey_eq
hash_function hash_functionhash_functionhash_functionhash_function
bucketsbucket bucketbucketbucketbucket
bucket_count bucket_countbucket_countbucket_countbucket_count
bucket_size bucket_sizebucket_sizebucket_sizebucket_size
max_bucket_count max_bucket_countmax_bucket_countmax_bucket_countmax_bucket_count
hash policyrehash rehashrehashrehashrehash
load_factor load_factorload_factorload_factorload_factor
max_load_factor max_load_factormax_load_factormax_load_factormax_load_factor
<ins id="pwjBlLZ"><video id="pwjBlLZ"></video></ins>
<ins id="pwjBlLZ"><span id="pwjBlLZ"><cite id="pwjBlLZ"></cite></span></ins><ins id="pwjBlLZ"><span id="pwjBlLZ"><cite id="pwjBlLZ"></cite></span></ins>
<del id="pwjBlLZ"></del>
<ins id="pwjBlLZ"><span id="pwjBlLZ"><cite id="pwjBlLZ"></cite></span></ins>
<ins id="pwjBlLZ"></ins><ins id="pwjBlLZ"><span id="pwjBlLZ"><cite id="pwjBlLZ"></cite></span></ins>
<ins id="pwjBlLZ"></ins>
<ins id="pwjBlLZ"></ins>
<var id="pwjBlLZ"></var>
<ins id="pwjBlLZ"><video id="pwjBlLZ"></video></ins><ins id="pwjBlLZ"><span id="pwjBlLZ"></span></ins><var id="pwjBlLZ"><span id="pwjBlLZ"><thead id="pwjBlLZ"></thead></span></var><ins id="pwjBlLZ"></ins>
<menuitem id="pwjBlLZ"><video id="pwjBlLZ"><thead id="pwjBlLZ"></thead></video></menuitem>
<cite id="pwjBlLZ"></cite>
<cite id="pwjBlLZ"><video id="pwjBlLZ"></video></cite>
<var id="pwjBlLZ"><video id="pwjBlLZ"><thead id="pwjBlLZ"></thead></video></var>
<ins id="pwjBlLZ"><span id="pwjBlLZ"><cite id="pwjBlLZ"></cite></span></ins><cite id="pwjBlLZ"></cite>
<var id="pwjBlLZ"><span id="pwjBlLZ"></span></var>
<ins id="pwjBlLZ"></ins><cite id="pwjBlLZ"><video id="pwjBlLZ"></video></cite><thead id="pwjBlLZ"><strike id="pwjBlLZ"><listing id="pwjBlLZ"></listing></strike></thead><cite id="pwjBlLZ"></cite><ins id="pwjBlLZ"><span id="pwjBlLZ"></span></ins>
<ins id="pwjBlLZ"></ins><ins id="pwjBlLZ"></ins>
<ins id="pwjBlLZ"></ins><ins id="pwjBlLZ"></ins>
<ins id="pwjBlLZ"><span id="pwjBlLZ"></span></ins><var id="pwjBlLZ"><span id="pwjBlLZ"></span></var>
<var id="pwjBlLZ"></var><var id="pwjBlLZ"></var><ins id="pwjBlLZ"></ins>
<var id="pwjBlLZ"><noframes id="pwjBlLZ"><menuitem id="pwjBlLZ"></menuitem>
<cite id="pwjBlLZ"><span id="pwjBlLZ"></span></cite><cite id="pwjBlLZ"><span id="pwjBlLZ"><var id="pwjBlLZ"></var></span></cite>
<ins id="pwjBlLZ"><span id="pwjBlLZ"></span></ins>
<ins id="pwjBlLZ"></ins>
<menuitem id="pwjBlLZ"><video id="pwjBlLZ"><thead id="pwjBlLZ"></thead></video></menuitem>
<menuitem id="pwjBlLZ"></menuitem>
  • 7133341522 2018-02-18
  • 5751021521 2018-02-18
  • 3975521520 2018-02-18
  • 4627271519 2018-02-18
  • 9487661518 2018-02-18
  • 3992831517 2018-02-18
  • 9809031516 2018-02-18
  • 865771515 2018-02-18
  • 452471514 2018-02-18
  • 5299351513 2018-02-18
  • 3036511512 2018-02-18
  • 4224301511 2018-02-18
  • 6975481510 2018-02-18
  • 8259761509 2018-02-18
  • 7007851508 2018-02-18
  • 7796301507 2018-02-18
  • 567811506 2018-02-18
  • 2107511505 2018-02-18
  • 8923811504 2018-02-17
  • 6039601503 2018-02-17