Windows apps
Collapse the table of content
Expand the table of content
Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

vector::end

 

Returns the past-the-end iterator.


      iterator end( ); 
const_iterator end( ) const;

The past-the-end iterator for the vector. If the vector is empty, vector::end() == vector::begin().

If the return value of end is assigned to a variable of type const_iterator, the vector object cannot be modified. If the return value of end is assigned to a variable of type iterator, the vector object can be modified.

Example

// vector_end.cpp
// compile with: /EHsc
#include <vector>
#include <iostream>
int main( )
{
   using namespace std;
   vector <int> v1;
   vector <int>::iterator v1_Iter;

   v1.push_back( 1 );
   v1.push_back( 2 );

   for ( v1_Iter = v1.begin( ) ; v1_Iter != v1.end( ) ; v1_Iter++ )
      cout << *v1_Iter << endl;
}
1
2

Requirements

Header: <vector>

Namespace: std

Show:
© 2016 Microsoft