Partager via


back_insert_iterator::container_type

Un type qui fournit un conteneur pour back_insert_iterator.

typedef Container container_type;

Notes

Le type est un synonyme pour le paramètre Conteneurde modèle.

Exemple

// back_insert_iterator_container_type.cpp
// compile with: /EHsc
#include <iterator>
#include <vector>
#include <iostream>

int main( )
{
   using namespace std;
   int i;

   vector<int> vec;
   for (i = 1 ; i < 4 ; ++i )  
   {
      vec.push_back (  i );
   }
   
   vector <int>::iterator vIter;
   cout << "The original vector vec is: ( ";
   for ( vIter = vec.begin ( ) ; vIter != vec.end ( ); vIter++)
      cout << *vIter << " ";
   cout << ")." << endl;

   back_insert_iterator<vector<int> >::container_type vec1 = vec;
   back_inserter ( vec1 ) = 40;

   cout << "After the insertion, the vector is: ( ";
   for ( vIter = vec1.begin ( ) ; vIter != vec1.end ( ); vIter++)
      cout << *vIter << " ";
   cout << ")." << endl;
}
  
  

Configuration requise

en-tête : <iterator>

l'espace de noms : DST

Voir aussi

Référence

back_insert_iterator Class

Modèles Standard