Condividi tramite


insert_iterator Class

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

For a list of all members of this type, see insert_iterator Members.

template <class Container>
class insert_iterator

Parameters

  • Container
    The type of container into which elements are to be inserted by an insert_iterator.

Remarks

The container of type Container must satisfy the requirements for a variable-sized container and have a two-argument insert member function where the parameters are of type Container::iterator and Container::value_type and that returns a type Container::iterator. Standard Template Library sequence and sorted associative containers satisfy these requirements and can be adapted to use with insert_iterators. For associative containers, the position argument is treated as a hint, which has the potential to improve or degrade performance depending on how good the hint is. An insert_iterator must always be initialized with its container.

Requirements

Header: <iterator>

Namespace: std

See Also

Reference

Thread Safety in the Standard C++ Library

Standard Template Library

Other Resources

insert_iterator Members

<iterator> Members