Creates a checked_array_iterator that can be used by other algorithms.

template <class _Iter>
checked_array_iterator<_Iter> make_checked_array_iterator(
    _Iter _Ptr,
    size_t _Size


  • _Ptr
    A pointer to the destination array.

  • _Size
    The size of the destination array.

Return Value

An instance of checked_array_iterator.


This function is defined in the stdext namespace.

For more information, see Checked Iterators.


In this example, a vector is created and populated with 10 items. The contents of the vector are copied into an array using the copy algorithm, using make_checked_array_iterator to specify the destination.

// make_checked_array_iterator.cpp
// compile with: /EHsc

#include <algorithm>
#include <iostream>
#include <vector>

using namespace std;

int main()
    const size_t dest_size = 10;
    int *dest = new int[dest_size];
    vector<int> v;

    for (int i = 0; i < 10; i++)

    copy(v.begin(), v.end(), stdext::make_checked_array_iterator(dest, dest_size));

    for (int i = 0; i < dest_size; i++)
        cout << dest[i] << endl;

    delete[] dest;

0 1 2 3 4 5 6 7 8 9


Header: <algorithm>

Namespace: stdext

See Also


Standard Template Library

Other Resources

<algorithm> Members