42#ifndef UFO_CONTAINER_TREE_PREDICATE_OR_HPP
43#define UFO_CONTAINER_TREE_PREDICATE_OR_HPP
46#include <ufo/container/tree/predicate/filter.hpp>
47#include <ufo/utility/type_traits.hpp>
56template <Filterable... Preds>
58 Or(Preds&&... preds) noexcept : preds(std::forward<Preds>(preds)...) {}
60 std::tuple<Preds...> preds;
66[[nodiscard]]
constexpr auto getOrTuple(T&& t)
noexcept
68 if constexpr (is_specialization_of_v<Or, std::remove_cvref_t<T>>) {
69 return std::forward<T>(t).preds;
71 return std::forward_as_tuple(std::forward<T>(t));
76template <Filterable PredLeft, Filterable PredRight>
77[[nodiscard]]
constexpr auto operator||(PredLeft&& p1, PredRight&& p2)
noexcept
81 return Or<std::remove_cvref_t<
decltype(preds)>...>(
82 std::forward<
decltype(preds)>(preds)...);
84 std::tuple_cat(detail::getOrTuple(std::forward<PredLeft>(p1)),
85 detail::getOrTuple(std::forward<PredRight>(p2))));
88template <Filterable... Preds>
93 static constexpr void init(
Pred& p,
Tree const& t)
noexcept
98 template <
class Value>
99 [[nodiscard]]
static constexpr bool returnableValue(
Pred const& p,
100 Value
const& v)
noexcept
103 [&v](
auto&&... preds) {
109 template <
class Tree>
110 [[nodiscard]]
static constexpr bool returnable(
Pred const& p,
Tree const& t,
114 [&t, &n](
auto&&... preds) {
120 template <
class Tree>
121 [[nodiscard]]
static constexpr bool traversable(
Pred const& p,
Tree const& t,
125 [&t, &n](
auto&&... preds) {
131 template <
class Tree>
132 [[nodiscard]]
static constexpr bool returnableRay(
Pred const& p,
Tree const& t,
137 [&t, &n, &r](
auto&&... preds) {
143 template <
class Tree>
144 [[nodiscard]]
static constexpr bool traversableRay(
Pred const& p,
Tree const& t,
149 [&t, &n, &r](
auto&&... preds) {
164 : std::conjunction<contains_always_pred<T, Ts>...> {
Utilizing curiously recurring template pattern (CRTP)