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.
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.
Constructors
Constructs an insert_iterator that inserts an element into a specified position in a container. |
Typedefs
A type that represents the container into which a general insertion is to be made. |
|
A type that provides a reference to an element in a sequence controlled by the associated container. |
Operators
Dereferencing operator used to implement the output iterator expression *i = x for a general insertion. |
|
Increments the insert_iterator to the next location into which a value may be stored. |
|
Assignment operator used to implement the output iterator expression *i = x for a general insertion. |
Requirements
Header: <iterator>
Namespace: std
See Also
Reference
Thread Safety in the Standard C++ Library