checked_array_iterator::operator[]
返回由 checked_array_iterator 位置指定数目的元素的偏移的引用。
reference operator[](
difference_type_Off
) const;
参数
- _Off
从 checked_array_iterator 的偏移量地址。
返回值
偏移量对元素的引用。
备注
有关详细信息,请参阅经过检查的迭代器。
示例
// 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
要求
头文件: <iterator>
**命名空间:**stdext