checked_array_iterator::operator+

Adds an offset to an iterator and returns the new checked_array_iterator addressing the inserted element at the new offset position.

checked_array_iterator<_Iterator> operator+(
   difference_type _Off
) const;

Parameters

  • _Off
    The offset to be added to the checked_array_iterator.

Return Value

A checked_array_iterator addressing the offset element.

Remarks

For more information, see Checked Iterators.

Example

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

int main() {
   using namespace stdext;
   using namespace std;
   int a[] = {6, 3, 77, 199, 222};
   int b[5];
   copy(a, a + 5, checked_array_iterator<int*>(b,5));

   checked_array_iterator<int*> checked_output_iterator(b,5);

   cout << *checked_output_iterator << endl;
   checked_output_iterator = checked_output_iterator + 3;
   cout << *checked_output_iterator << endl;
}

6
199

Requirements

Header: <iterator>

Namespace: stdext

See Also

Concepts

checked_array_iterator Class

checked_array_iterator Members

Standard Template Library