Standard C++ Library Reference ISO/IEC (VERSION3)
typedef T8 const_reverse_iterator;
iterator begin();
const_iterator begin() const;
iterator end();
const_iterator end() const;
reverse_iterator rbegin();
const_reverse_iterator rbegin() const;
reverse_iterator rend();
const_reverse_iterator rend() const;
size_type size() const;
size_type max_size() const;
bool empty() const;
iterator erase(iterator where);
iterator erase(iterator first, iterator last);
void clear();
void swap(Container& right);
};
The template class describes an object that controls a varying-length sequence of elements,
typically of type Ty. The sequence is stored in different ways, depending on the actual
container.
A container constructor or member function may find occasion to call the constructor
Ty(const Ty&) or the function Ty::operator=(const Ty&). If such a call throws an
exception, the container object is obliged to maintain its integrity, and to rethrow any exception
it catches. You can safely swap, assign to, erase, or destroy a container object after it throws
one of these exceptions. In general, however, you cannot otherwise predict the state of the
sequence controlled by the container object.
A few additional caveats:
If the expression ~Ty() throws an exception, the resulting state of the container object is
undefined.
●
If the container stores an allocator object al, and al throws an exception other than as a
result of a call to al.allocate, the resulting state of the container object is undefined.
●
If the container stores a function object comp, to determine how to order the controlled
sequence, and comp throws an exception of any kind, the resulting state of the container
object is undefined.
●
The container classes defined by STL satisfy several additional requirements, as described in
the following paragraphs.
Container template class list provides deterministic, and useful, behavior even in the
presence of the exceptions described above. For example, if an exception is thrown during the
insertion of one or more elements, the container is left unaltered and the exception is rethrown.