vector::pointer

A type that provides a pointer to an element in a vector.

typedef typename Allocator::pointer pointer;

A type pointer can be used to modify the value of an element.

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

int main( )
{
   using namespace std;
   vector<int> v;
   v.push_back( 11 );
   v.push_back( 22 );

   vector<int>::pointer ptr = &v[0];
   cout << *ptr << endl;
   ptr++;
   cout << *ptr << endl;
   *ptr = 44;
   cout << *ptr << endl;
}
11
22
44

Header: <vector>

Namespace: std

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft