Namespaces
Variants
Views
Actions

std::insert_iterator<Container>::insert_iterator

From cppreference.com
 
 
Iterator library
Iterator concepts
Iterator primitives
Algorithm concepts and utilities
Indirect callable concepts
Common algorithm requirements
Utilities
(C++20)
Iterator adaptors
Stream iterators
Iterator customization points
Iterator operations
(C++11)
(C++11)
Range access
(C++11)(C++14)
(C++11)(C++14)
(C++17)(C++20)
(C++14)(C++14)
(C++14)(C++14)
(C++17)
(C++17)
 
 
insert_iterator( Container& c, typename Container::iterator i );
(until C++20)
constexpr insert_iterator( Container& c, ranges::iterator_t<Container> i );
(since C++20)

Initializes the underlying pointer to the container to std::addressof(c) and the underlying iterator to i.

[edit] Parameters

c - container to initialize the inserter with
i - iterator to initialize the inserter with

[edit] Defect reports

The following behavior-changing defect reports were applied retroactively to previously published C++ standards.

DR Applied to Behavior as published Correct behavior
P2325R3 C++20 default constructor was provided as C++20 iterators
must be default_initializable
removed along with the requirement