vendredi 4 septembre 2020

Iterator or std::iota with regular C++ Array?

Is there a way to achieve the same effect as this,

std::list<int> l(10);
std::iota(l.begin(), l.end(), -4);

With a regular int a[]?

Or, is the following the only way around:

for (iterator itr = begin; itr != end; ++itr)
    /* ... visit *itr here ... */

Aucun commentaire:

Enregistrer un commentaire