N
Nikos Chantziaras
Is there some simple way to convert this:
std::vector<int> vec;
// ...
for (size_t i = 1; i < vec.size(); ++i)
// do something with vec
to a for-loop that uses iterators? I've tried:
typedef std::vector<int>::iterator it_t;
for (it_t i = vec.begin() + 1; i != vec.end(); ++i)
// do something with *i
but I'm not surprised that it doesn't work.
std::vector<int> vec;
// ...
for (size_t i = 1; i < vec.size(); ++i)
// do something with vec
to a for-loop that uses iterators? I've tried:
typedef std::vector<int>::iterator it_t;
for (it_t i = vec.begin() + 1; i != vec.end(); ++i)
// do something with *i
but I'm not surprised that it doesn't work.