Partager via


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;

Parameters

  • _Off
    The offset from the checked_array_iterator address.

Return Value

The reference to the element offset.

Remarks

For more information, see Checked Iterators.

Example

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

Requirements

Header: <iterator>

Namespace: stdext

See Also

Reference

checked_array_iterator Class

Standard Template Library