close

在STL中 , 包含了很多不同的container class , 可以直接讓我們來進行使用.

不過 , 一般來說可以分為三大類:

分別為Sequence containers, Associative containers, and Container adapters


Sequence containers:

Sequence contains are container classes that maintain the ordering of elements in the container.

The STL contains 3 sequence containers: vector, deque, and list.


Associative containers:

Associative contains are containers that automatically sort their inputs when those inputs are inserted into the container.

By default, associative containers compare elements using operator<.

The associative containers are set , multiset , map , multimap.

 

Container adapters:

Container adapters are special predefined containers that are adapted to specific uses. 

The interesting part about container adapters is that you can choose which sequence container you want them to use.

there are stack , queue , and priority queue.


P.S

What is difference between Container adapters and others?

 Many containers have several member functions in common, and share functionalities.

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 asdeque 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 class

 independently of the underlying container class used.

 

ref : http://www.learncpp.com/cpp-programming/16-2-stl-containers-overview/

ref : http://www.cplusplus.com/reference/stl/

arrow
arrow
    全站熱搜
    創作者介紹
    創作者 JerryCheng 的頭像
    JerryCheng

    KwCheng's blog

    JerryCheng 發表在 痞客邦 留言(0) 人氣()