Share via


checked_array_iterator::operator*

Returns the element that a checked_array_iterator addresses.

reference operator*( ) const;

Return Value

The value of the element addressed by the checked_array_iterator.

Remarks

For more information, see Checked Iterators.

Example

// checked_array_iterator_pointer.cpp
// compile with: /EHsc
#include <iterator>
#include <algorithm>
#include <vector>
#include <utility>
#include <iostream>

using namespace std;
using namespace stdext;

int main() {
   int a[] = {0, 1, 2, 3, 4};
   int b[5];
   pair<int, int> c[1];
   copy(a, a + 5, checked_array_iterator<int*>(b,5));

   for (int i = 0 ; i < 5 ; i++)
      cout << b[i] << endl;

    c[0].first = 10;
    c[0].second = 20;
    
   checked_array_iterator<int*> checked_output_iterator(b,5);
   checked_array_iterator<int*>::pointer p = &(*checked_output_iterator);
   checked_array_iterator<pair<int, int>*> chk_c(c, 1);
   checked_array_iterator<pair<int, int>*>::pointer p_c = &(*chk_c);
   
   cout << "b[0] = " << *p << endl;
   cout << "c[0].first = " << p_c->first << endl;
}
0
1
2
3
4
b[0] = 0
c[0].first = 10

Requirements

Header: <iterator>

Namespace: stdext

See Also

Reference

checked_array_iterator Class

Standard Template Library

Other Resources

checked_array_iterator Members