Export (0) Print
Expand All

STL Containers

A container is an STL template class that manages a sequence of elements. Such elements can be of any object type that supplies a copy constructor, a destructor, and an assignment operator. The destructor may not throw an exception. This document describes the properties required of all such containers, in terms of a generic template class container. An actual container template class may have additional template parameters. It will certainly have additional member functions.

The STL template container classes are:

The four hash containers are not required by the C++ Standard. The Standard C++ Library template class basic_string also meets the requirements for a template container class.

namespace std 
{
template<class Ty>
   class Container;

        // TEMPLATE FUNCTIONS
template<class Ty>
   bool operator==(
      const Container<Ty>& left,
      const Container<Ty>& right);
template<class Ty>
   bool operator!=(
      const Container<Ty>& left,
      const Container<Ty>& right);
template<class Ty>
   bool operator<(
      const Container<Ty>& left,
      const Container<Ty>& right);
template<class Ty>
   bool operator>(
      const Container<Ty>& left,
      const Container<Ty>& right);
template<class Ty>
   bool operator<=(
      const Container<Ty>& left,
      const Container<Ty>& right);
template<class Ty>
   bool operator>=(
      const Container<Ty>& left,
      const Container<Ty>& right);
template<class Ty>
   void swap(
      Container<Ty>& left,
      Container<Ty>& right);
};

For a sample container class, see <sample container>.

See Also

Standard Template Library Conventions

Show:
© 2014 Microsoft