Udostępnij za pośrednictwem


vector::pointer

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

typedef typename Allocator::pointer pointer;

Remarks

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

Example

// 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

Requirements

Header: <vector>

Namespace: std

See Also

Reference

vector Class

Standard Template Library

Other Resources

vector Members