Questions tagged «ranged-loops»

8
C ++ 11基于反向范围的for循环
是否有一个容器适配器可以颠倒迭代器的方向,以便我可以使用基于范围的for循环反向迭代容器? 使用显式迭代器,我可以将其转换为: for (auto i = c.begin(); i != c.end(); ++i) { ... 到这个: for (auto i = c.rbegin(); i != c.rend(); ++i) { ... 我想将其转换为: for (auto& i: c) { ... 对此: for (auto& i: std::magic_reverse_adapter(c)) { ... 有这样的事情还是我必须自己写?
321 c++  c++11  ranged-loops 
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.