Make the canReachRoots() traversal non-recursive

This commit is contained in:
Eelco Dolstra
2021-10-14 12:34:32 +02:00
parent 09b14ea97a
commit eab934cb2a
3 changed files with 115 additions and 111 deletions
+11
View File
@@ -523,6 +523,17 @@ std::optional<typename T::value_type> remove_begin(T & c)
}
/* Remove and return the first item from a container. */
template <class T>
std::optional<typename T::value_type> pop(T & c)
{
if (c.empty()) return {};
auto v = std::move(c.front());
c.pop();
return v;
}
template<typename T>
class Callback;