make_checked_array_iterator
Crea checked_array_iterator utilizzabile da altri algoritmi.
template <class _Iter>
checked_array_iterator<_Iter> make_checked_array_iterator(
_Iter _Ptr,
size_t _Size
;)
Parametri
_Ptr
Un puntatore alla matrice di destinazione._Size
La dimensione della matrice di destinazione.
Valore restituito
Un'istanza di checked_array_iterator.
Note
Questa funzione è definita nello spazio dei nomi stdext.
Per ulteriori informazioni, vedere Iteratori verificati.
Esempio
In questo esempio, vettore viene creato e compilato con 10 elementi.Il contenuto del vettore viene copiato in una matrice utilizzando l'algoritmo di copia, utilizzando make_checked_array_iterator per specificare la destinazione.
// 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++)
{
v.push_back(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;
}
Requisiti
intestazione: <algorithm>
Stdext diSpazio dei nomi: