C++: Accéder à un deque comme un tableau

Author:

 deque
{filelink=14994}


#include 
#include 
#include 
#include 
using std::cout;
using std::endl;

int main()
{
	// création d'un deque de double
   std::deque< double > deq;
   std::ostream_iterator< double > output( cout, "n" );

   deq.push_front( 1.5 );
   deq.push_front( 2.5 );
   deq.push_back(  3.5 );

   cout << "Accès au contenu par index: ";
   for ( int i = 0; i < deq.size(); i++ )
      cout << deq[ i ] << ' ';
   cout << endl;
   return 0;
}

Leave a Reply

Your email address will not be published. Required fields are marked *