Partager via


vector::end

Returns the past-the-end iterator.

iterator end( ); 
const_iterator end( ) const;

Return Value

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

Example

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

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

Requirements

Header: <vector>

Namespace: std

See Also

Reference

vector Class

Standard Template Library