front_insert_iterator Class

Describes an iterator adaptor that satisfies the requirements of an output iterator. It inserts, rather than overwrites, elements into the front of a sequence and thus provides semantics that are different from the overwrite semantics provided by the iterators of the C++ sequence containers. The front_insert_iterator class is templatized on the type of container.

template <class Container> 
class front_insert_iterator

Parameters

  • Container
    The type of container into the front of which elements are to be inserted by a front_insert_iterator.

Remarks

The container must satisfy the requirements for a front insertion sequence where is it possible to insert elements at the beginning of the sequence in amortized constant time. The Standard Template Library sequence containers defined by the deque Class and list Class provide the needed push_front member function and satisfy these requirements. By contrast, sequence containers defined by the vector Class do not satisfy these requirements and cannot be adapted to use with front_insert_iterators. A front_insert_iterator must always be initialized with its container.

Constructors

front_insert_iterator

Creates an iterator that can insert elements at the front of a specified container object.

Typedefs

container_type

A type that represents the container into which a front insertion is to be made.

reference

A type that provides a reference to an element in a sequence controlled by the associated container.

Operators

operator*

Dereferencing operator used to implement the output iterator expression *i = x for a front insertion.

operator++

Increments the front_insert_iterator to the next location into which a value may be stored.

operator=

Assignment operator used to implement the output iterator expression *i = x for a front insertion.

Requirements

Header: <iterator>

Namespace: std

See Also

Reference

Thread Safety in the Standard C++ Library

Standard Template Library

Other Resources

front_insert_iterator Members

<iterator> Members