Possible duplicate:
C ++ 11 for-loop based on inverse range
Is there a reverse range forin C++11?
I want to do something like this:
for(int value : vec)
{
cout << value << endl;
}
For this:
for(auto it = vec.rbegin(); it != vec.rend(); ++it)
{
cout << *it << endl;
}
For instance:
for(int value : -vec)
{
cout << value << endl;
}
Is it possible to do something similar for a reverse loop?
source
share