我有一个while循环,我想用std/boost算法取代(主要是为了我的学习,沿着Sean Parent的无原始循环格言).
std::queue q;
while (! q.empty()) {
auto front = q.front();
q.pop();
do_stuff_with_front();
potentially_insert_more_into_q();
}
Run Code Online (Sandbox Code Playgroud)
如您所见,我有条件地将更多元素排入循环中; 想想迷宫遍历.什么std/boost算法可能适合这个?
| 归档时间: |
|
| 查看次数: |
387 次 |
| 最近记录: |