Namespaces
Variants
Views
Actions

Talk:cpp/iterator/back inserter

From cppreference.com
   #include <algorithms>
   #include <iterator>
   #include <vector>
   using namespace std;
   
   int main()
   {
       int data[10] = {1,2,3,4,5,6,7,8,9,10};
       vector<int> vector_data(data, data+10);
  
       fill_on(back_inserter(vector_data), 3, -1);
       // 1 2 3 4 5 6 7 8 9 10 -1 -1 -1
       return 0;
   }