Rogue Wave banner
Previous fileTop of documentContentsIndexNext file

back_insert_iterator, back_inserter


Insert Iterator

Summary

An insert iterator used to insert items at the end of a collection.

Data Type and Member Function Indexes
(exclusive of constructors and destructors)

Synopsis

#include <iterator>
template <class Container> 
class back_insert_iterator;

Description

Insert iterators let you insert new elements into a collection rather than copy a new element's value over the value of an existing element. The class back_insert_iterator is used to insert items at the end of a collection. The function back_inserter creates an instance of a back_insert_iterator for a particular collection type. A back_insert_iterator can be used with vectors, deques, and lists, but not with maps or sets.

Interface

Types

container_type

The type of container acted on by this iterator.

Constructors

explicit
back_insert_iterator (Container& x);

Operators

back_insert_iterator<Container>&
operator= (const typename Container::value_type& value);
back_insert_iterator<Container>& 
operator* ();
back_insert_iterator<Container>& 
operator++ ();
back_insert_iterator<Container> 
operator++ (int);

Helper Functions

template <class Container>
back_insert_iterator<Container>
back_inserter (Container& x)

Example

Program Output

Warnings

If your compiler does not support default template parameters, then you always need to supply the Allocator template argument. For instance, you have to write:

vector<int,allocator<int> >

instead of:

vector<int>

If your compiler does not support namespaces, then you do not need the using declaration for std.

See Also

Insert Iterators



Previous fileTop of documentContentsIndexNext file
Copyright (c) 1998, Rogue Wave Software, Inc.
Send mail to report errors or comment on the documentation.
OEM Release, June 1998