Export (0) Print
Expand All

checked_array_iterator::operator[]

Returns a reference to an element offset from the element addressed by a checked_array_iterator by a specified number of positions.

reference operator[](
   difference_type_Off
) const;

_Off

The offset from the checked_array_iterator address.

The reference to the element offset.

For more information, see Checked Iterators.

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

int main() {
   using namespace std;   
   int V1[10];

   for (int i = 0; i < 10 ; i++)
      V1[i] = i;

   // Declare a difference type for a parameter
   stdext::checked_array_iterator<int*>::difference_type diff = 2;

   stdext::checked_array_iterator<int*> VChkIter(V1, 10);

   stdext::checked_array_iterator<int*>::reference refrpos = VChkIter [diff];

   cout << refrpos + 1 << endl;
}
3

Header: <iterator>

Namespace: stdext

Show:
© 2014 Microsoft