Sei sulla pagina 1di 2

Containers - C++ Reference

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

Search: Reference C++


Information Documentation Reference Articles Forum

Go

Containers

Reference
C library: Containers: <array> <deque> <forward_list> <list> <map> <queue> <set> <stack> <unordered_map> <unordered_set> <vector> Input/Output: Multi-threading: Other:

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.

Answers to C++ Questions


www.daniweb.com Free Answers to Your Programming Language Questions. Register Now!

Container class templates


Sequence containers : array vector deque forward_list list Container adaptors : stack queue priority_queue Associative containers : set multiset map multimap Set (class template ) Multiple-key set (class template ) Map (class template ) Multiple-key map (class template ) LIFO stack (class template ) FIFO queue (class template ) Priority queue (class template ) Array class (class template ) Vector (class template ) Double ended queue (class template ) Forward list (class template ) List (class template )

Unordered associative containers: unordered_set unordered_multiset unordered_map unordered_multimap Unordered Set (class template ) Unordered Multiset (class template ) Unordered Map (class template ) Unordered Multimap (class template )

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++98 Available since C++98 C++11 New in C++11 Sequence containers Headers Members constructor destructor operator= begin iterators end rbegin rend begin const iterators cend crbegin crend size max_size capacity empty resize shrink_to_fit capacity reserve front back element access operator[] at assign emplace insert erase emplace_back modifiers push_back pop_back emplace_front push_front pop_front clear clear front back <array> <vector> array vector implicit vector implicit ~vector implicit begin end rbegin rend cbegin cend crbegin crend size operator= begin end rbegin rend cbegin cend crbegin crend size <deque> deque deque ~deque operator= begin end rbegin rend cbegin cend crbegin crend size max_size empty resize shrink_to_fit max_size empty resize cbegin cbefore_begin cend <forward_list> <list> forward_list list forward_list list ~forward_list ~list operator= begin before_begin end operator= begin end rbegin rend cbegin cend crbegin crend size max_size empty resize

max_size max_size empty empty resize shrink_to_fit capacity reserve front back

front back operator[] at assign emplace insert erase

front

front back

operator[] operator[] at at assign emplace insert erase

assign emplace_after insert_after erase_after

assign emplace insert erase emplace_back push_back pop_back emplace_front push_front pop_front clear

emplace_back emplace_back push_back push_back pop_back pop_back emplace_front emplace_front push_front push_front pop_front clear pop_front clear

1 of 2

30-11-2013 20:00

Containers - C++ Reference

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

Associative containers Headers Members constructor destructor assignment begin iterators end rbegin rend cbegin const iterators cend crbegin crend size max_size empty reserve at operator[] emplace emplace_hint modifiers insert erase clear swap count find operations equal_range lower_bound upper_bound get_allocator key_comp observers value_comp key_eq hash_function bucket buckets bucket_count bucket_size max_bucket_count rehash hash policy load_factor max_load_factor emplace emplace set ~set operator= begin end rbegin rend cbegin cend crbegin crend size max_size empty set <set> multiset multiset ~multiset operator= begin end rbegin rend cbegin cend crbegin crend size max_size empty map map ~map operator= begin end rbegin rend cbegin cend crbegin crend size max_size empty at operator[] emplace emplace emplace emplace emplace_hint insert erase clear swap count find equal_range emplace_hint emplace_hint emplace_hint emplace_hint emplace_hint insert insert insert insert insert erase clear swap count find erase clear swap count find erase clear swap count find erase clear swap count find erase clear swap count find <map> multimap multimap ~multimap operator= begin end rbegin rend cbegin cend crbegin crend size max_size empty size max_size empty reserve size max_size empty reserve size max_size empty reserve at operator[] emplace emplace_hint insert erase clear swap count find equal_range emplace emplace_hint insert erase clear swap count find equal_range size max_size empty reserve cbegin cend cbegin cend cbegin cend cbegin cend <unordered_set> <unordered_map> unordered_set unordered_multiset unordered_map unordered_multimap unordered_set ~unordered_set operator= begin end unordered_multiset unordered_map unordered_multimap ~unordered_multiset ~unordered_map ~unordered_multimap operator= begin end operator= begin end operator= begin end

capacity

element access

equal_range equal_range equal_range equal_range equal_range lower_bound lower_bound lower_bound lower_bound upper_bound upper_bound upper_bound upper_bound get_allocator get_allocator get_allocator get_allocator get_allocator key_comp key_comp key_comp key_comp value_comp value_comp value_comp value_comp key_eq hash_function bucket bucket_count bucket_size rehash load_factor max_load_factor

get_allocator

get_allocator

get_allocator

key_eq hash_function bucket bucket_count bucket_size rehash load_factor max_load_factor

key_eq hash_function bucket bucket_count bucket_size rehash load_factor max_load_factor

key_eq hash_function bucket bucket_count bucket_size rehash load_factor max_load_factor

max_bucket_count max_bucket_count

max_bucket_count max_bucket_count

SourceXR
www.sourcexr.com C/C++ Cross-Reference Tool Semantic Source Code Analysis
Home page | Privacy policy cplusplus.com, 2000-2013 - All rights reserved - v3.1 Spotted an error? contact us

2 of 2

30-11-2013 20:00

Potrebbero piacerti anche