.TH "std::insert_iterator< _Container >" 3cxx "Tue Jun 13 2023" "libstdc++" \" -*- nroff -*- .ad l .nh .SH NAME std::insert_iterator< _Container > \- Turns assignment into insertion\&. .SH SYNOPSIS .br .PP .PP \fC#include \fP .PP Inherits \fBstd::iterator< output_iterator_tag, void, void, void, void >\fP\&. .SS "Public Types" .in +1c .ti -1c .RI "typedef _Container \fBcontainer_type\fP" .br .RI "A nested typedef for the type of whatever container you used\&. " .ti -1c .RI "using \fBdifference_type\fP = ptrdiff_t" .br .ti -1c .RI "typedef \fBoutput_iterator_tag\fP \fBiterator_category\fP" .br .RI "One of the \fBtag types\fP\&. " .ti -1c .RI "typedef void \fBpointer\fP" .br .RI "This type represents a pointer-to-value_type\&. " .ti -1c .RI "typedef void \fBreference\fP" .br .RI "This type represents a reference-to-value_type\&. " .ti -1c .RI "typedef void \fBvalue_type\fP" .br .RI "The type 'pointed to' by the iterator\&. " .in -1c .SS "Public Member Functions" .in +1c .ti -1c .RI "constexpr \fBinsert_iterator\fP (_Container &__x, _Iter __i)" .br .ti -1c .RI "constexpr \fBinsert_iterator\fP & \fBoperator*\fP ()" .br .RI "Simply returns *this\&. " .ti -1c .RI "constexpr \fBinsert_iterator\fP & \fBoperator++\fP ()" .br .RI "Simply returns *this\&. (This iterator does not \fImove\fP\&.) " .ti -1c .RI "constexpr \fBinsert_iterator\fP & \fBoperator++\fP (int)" .br .RI "Simply returns *this\&. (This iterator does not \fImove\fP\&.) " .ti -1c .RI "constexpr \fBinsert_iterator\fP & \fBoperator=\fP (const typename _Container::value_type &__value)" .br .ti -1c .RI "constexpr \fBinsert_iterator\fP & \fBoperator=\fP (typename _Container::value_type &&__value)" .br .in -1c .SS "Protected Attributes" .in +1c .ti -1c .RI "_Container * \fBcontainer\fP" .br .ti -1c .RI "_Iter \fBiter\fP" .br .in -1c .SH "Detailed Description" .PP .SS "template .br class std::insert_iterator< _Container >"Turns assignment into insertion\&. These are output iterators, constructed from a container-of-T\&. Assigning a T to the iterator inserts it in the container at the iterator's position, rather than overwriting the value at that position\&. .PP (Sequences will actually insert a \fIcopy\fP of the value before the iterator's position\&.) .PP Tip: Using the inserter function to create these iterators can save typing\&. .SH "Member Typedef Documentation" .PP .SS "template typedef _Container \fBstd::insert_iterator\fP< _Container >::container_type" .PP A nested typedef for the type of whatever container you used\&. .SS "typedef \fBoutput_iterator_tag\fP \fBstd::iterator\fP< \fBoutput_iterator_tag\fP , void , void , void , void >::iterator_category\fC [inherited]\fP" .PP One of the \fBtag types\fP\&. .SS "typedef void \fBstd::iterator\fP< \fBoutput_iterator_tag\fP , void , void , void , void >::pointer\fC [inherited]\fP" .PP This type represents a pointer-to-value_type\&. .SS "typedef void \fBstd::iterator\fP< \fBoutput_iterator_tag\fP , void , void , void , void >::reference\fC [inherited]\fP" .PP This type represents a reference-to-value_type\&. .SS "typedef void \fBstd::iterator\fP< \fBoutput_iterator_tag\fP , void , void , void , void >::value_type\fC [inherited]\fP" .PP The type 'pointed to' by the iterator\&. .SH "Constructor & Destructor Documentation" .PP .SS "template constexpr \fBstd::insert_iterator\fP< _Container >::insert_iterator (_Container & __x, _Iter __i)\fC [inline]\fP, \fC [constexpr]\fP" The only way to create this iterator is with a container and an initial position (a normal iterator into the container)\&. .SH "Member Function Documentation" .PP .SS "template constexpr \fBinsert_iterator\fP & \fBstd::insert_iterator\fP< _Container >::operator* ()\fC [inline]\fP, \fC [constexpr]\fP" .PP Simply returns *this\&. .SS "template constexpr \fBinsert_iterator\fP & \fBstd::insert_iterator\fP< _Container >::operator++ ()\fC [inline]\fP, \fC [constexpr]\fP" .PP Simply returns *this\&. (This iterator does not \fImove\fP\&.) .SS "template constexpr \fBinsert_iterator\fP & \fBstd::insert_iterator\fP< _Container >::operator++ (int)\fC [inline]\fP, \fC [constexpr]\fP" .PP Simply returns *this\&. (This iterator does not \fImove\fP\&.) .SS "template constexpr \fBinsert_iterator\fP & \fBstd::insert_iterator\fP< _Container >::operator= (const typename _Container::value_type & __value)\fC [inline]\fP, \fC [constexpr]\fP" .PP \fBParameters\fP .RS 4 \fI__value\fP An instance of whatever type container_type::const_reference is; presumably a reference-to-const T for container\&. .RE .PP \fBReturns\fP .RS 4 This iterator, for chained operations\&. .RE .PP This kind of iterator maintains its own position in the container\&. Assigning a value to the iterator will insert the value into the container at the place before the iterator\&. .PP The position is maintained such that subsequent assignments will insert values immediately after one another\&. For example, .PP .nf // vector v contains A and Z insert_iterator i (v, ++v\&.begin()); i = 1; i = 2; i = 3; // vector v contains A, 1, 2, 3, and Z .fi .PP .SH "Author" .PP Generated automatically by Doxygen for libstdc++ from the source code\&.