Possible Duplicate:
C++11 reverse range-based for-loop
Is there an inverse range-based for
in C++11
?
I want to do something like this:
for(int value : vec)
{
cout << value << endl;
}
To do this:
for(auto it = vec.rbegin(); it != vec.rend(); ++it)
{
cout << *it << endl;
}
For instance:
for(int value : -vec)
{
cout << value << endl;
}
Is possible do something like that to do an inverse loop?