template
class backwards {
T& _obj;
public:
backwards(T &obj) : _obj(obj) {}
auto begin() {return _obj.rbegin();}
auto end() {return _obj.rend();}
};
for (auto &elem : backwards(vec)) {
// ...useful code
}
Top comments (0)