// checked_iterators_3.cpp
// compile with: /EHsc /W3
#define _SECURE_SCL 1
#include <algorithm>
#include <iostream>
using namespace std;
using namespace stdext;
int main() {
int a[] = { 1, 2, 3 };
int *b = new int[10];
int c[10];
copy(a, a + 3, b); // C4996 unchecked iterator
copy(a, a + 3, checked_array_iterator<int*>(c, _countof(c))); // OK
delete[] b;
}