Chapter: Programming and Data structures : C++ Programming Advanced Features

Containers

A Container is an object that stores other objects (its elements), and that has methods for accessing its elements. It is a way data is organized in memory.

CONTAINERS:

 

A Container is an object that stores other objects (its elements), and that has methods for accessing its elements. It is a way data is organized in memory. The STL containers are implemented by template classes and therefore can be easily customized to hold different types of data.

 

 

The STL contains three types of containers

§    Sequence containers

 

§    Associative containers

 

§    Derived containers

 

Sequence Containers:

 

Sequence containers store elements in a linear sequence, like a line. Each element is related to other elements by its position along the line. They all expand themselves to allow insertion of elements and all of them support a number of operations on them.

 

 

The following are the types of sequence containers.

ü   Vector

 

ü   List

 

ü   deque

 


 

Associative Containers:

 

Associative containers are designed to support direct access to elements using keys.

 

 

The following are the types of associative containers.

 

ü   Set

 

ü   Multiset

 

ü   Map

 

ü   Multimap

 

Derived Containers:

 

The derived containers do not support iterators and therefore we cannot use them for data manipulation. They support two member functions pop() and push() for implementing deleting and inserting operations.

 

 

The following are the types of associative containers.

ü   Stack

 

ü   Queue

 

ü   Priority_queue

 

Study Material, Lecturing Notes, Assignment, Reference, Wiki description explanation, brief detail
Programming and Data structures : C++ Programming Advanced Features : Containers |


Privacy Policy, Terms and Conditions, DMCA Policy and Compliant

Copyright © 2018-2023 BrainKart.com; All Rights Reserved. Developed by Therithal info, Chennai.