checked_iterator::operator-
Decrements an offset from an iterator and returns the new checked_iterator addressing the inserted element at the new offset position.
checked_iterator<_Cont, _Iter> operator-(
difference_type _Off
) const;
Parameters
- _Off
The offset to be decremented from the checked_iterator.
Return Value
A checked_iterator addressing the offset element.
Remarks
For more information, see Checked Iterators.
Example
// checked_iterators_op_minus.cpp
// compile with: /EHsc
#include <vector>
#include <iostream>
int main() {
using namespace std;
vector<int> V1;
for (int i = 0; i < 10 ; i+)
V1.push_back(i);
stdext::checked_iterator< vector<int> > VChkIter(V1, V1.end());
VChkIter = VChkIter - 1;
cout << *VChkIter << endl;
VChkIter = VChkIter - 4;
cout << *VChkIter << endl;
}
9 5
Requirements
Header: <iterator>
Namespace: stdext