2#include "common/common.hpp"
3#include "canvas/selectables.hpp"
8inline auto sel_filter_type(ObjectType type)
10 return ranges::views::filter([type](
const SelectableRef &x) {
return x.type == type; });
13template <
typename Tk,
typename Tv>
auto map_ptr_from_sel(std::map<Tk, Tv> &m)
15 return [&m](
const SelectableRef &x) {
return &m.at(x.uuid); };
19template <
typename Tk,
typename Tv>
auto map_ref_from_sel(std::map<Tk, Tv> &m)
21 return ranges::views::transform([&m](
const SelectableRef &x) -> Tv & {
return m.at(x.uuid); });
24template <
typename Tr,
typename Tp>
auto find_if_ptr(Tr &&range, Tp pred)
26 auto x = ranges::find_if(range, pred);
28 return static_cast<decltype(&*x)
>(
nullptr);