Wednesday, March 23, 2011

STL containers

What are the types of STL containers?

• deque
• hash_map
• hash_multimap
• hash_multiset
• hash_set
• list
• map
• multimap
• multiset
• set
• vector


Currently there are two major types of containers defined in the C++ library: sequence containers and associative containers.
Sequence containers are: vector deque list
Associative containers are: set multiset map and multimap.

There are 3 containers adapters: stack queue and priority_queue.

The STL has two more data structures that some people argue they might be containers as well: bitset and valarray. There is also the specialization of the vector container for booleans which might not be a container.

No hash containers are defined in the current C++ STL standard. However other STL implementation might have some hash based containers (ie STL SGI implementation).

The upcoming C++ standard defines among others in TR1 (Technical Report 1) new containers : array unorder_set unordered_multiset unorder_map and unordered_multimap. Most of the TR1 is implemented in the gcc compiler. Dinkumware has a full TR1 specification implementation.

No comments:

Post a Comment