Commit fdb812e9 authored by Dominik Charousset's avatar Dominik Charousset

Add const overload to for_each_path

parent bc17c906
......@@ -111,6 +111,24 @@ public:
for_each_path_impl(g);
}
/// Applies `f` to each path.
template <class F>
void for_each_path(F f) const {
struct impl : path_visitor {
F fun;
impl(F x) : fun(std::move(x)) {
// nop
}
void operator()(outbound_path& x) override {
fun(const_cast<const outbound_path&>(x));
}
};
impl g{std::move(f)};
// This const_cast is safe, because we restore the const in our overload for
// operator() above.
const_cast<downstream_manager*>(this)->for_each_path_impl(g);
}
/// Returns all used slots.
std::vector<stream_slot> path_slots();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment