A
Andrea Crotti
The "standard" way to iterate over a container should be:
std::vector<int>::iterator iter;
for (iter=var.begin(); iter!=var.end(); ++iter) {
...
}
for example, right?
But I always end up using
for (size_t i=0; i < var.size(); ++i) {
...
}
(unless I'm using maps)
because it's much shorter to write and I don't need the iterator. But
are there any real differences using this two different possibilities?
std::vector<int>::iterator iter;
for (iter=var.begin(); iter!=var.end(); ++iter) {
...
}
for example, right?
But I always end up using
for (size_t i=0; i < var.size(); ++i) {
...
}
(unless I'm using maps)
because it's much shorter to write and I don't need the iterator. But
are there any real differences using this two different possibilities?