Skip to content

insert_iterator and inserter

cppreference std::insert_iterator

std::insert_iterator is a LegacyOutputIterator that inserts elements into a container for which it was constructed, at the position pointed to by the supplied iterator. The container's insert() member function is called whenever the iterator (whether dereferenced or not) is assigned to. Incrementing the std::insert_iterator is a no-op.

NOTE: 每次调用“container's insert() member function”,保证了可以连续地insert。

cppreference std::inserter