UFO 1.0.0
An Efficient Probabilistic 3D Mapping Framework That Embraces the Unknown
Loading...
Searching...
No Matches
boolean.hpp
1
42#ifndef UFO_CONTAINER_TREE_PREDICATE_BOOLEAN_HPP
43#define UFO_CONTAINER_TREE_PREDICATE_BOOLEAN_HPP
44
45// UFO
46#include <ufo/container/tree/predicate/filter.hpp>
47
48namespace ufo::pred
49{
50template <bool Negated = false>
51struct Boolean {
52};
53
54template <bool Negated>
55[[nodiscard]] constexpr Boolean<!Negated> operator!(Boolean<Negated> const&) noexcept
56{
57 return Boolean<!Negated>{};
58}
59
60using True = Boolean<true>;
61using False = Boolean<false>;
62
63template <bool Negated>
64struct Filter<Boolean<Negated>> {
65 using Pred = Boolean<Negated>;
66
67 template <class Tree>
68 static constexpr void init(Pred&, Tree const&) noexcept
69 {
70 }
71
72 template <class Value>
73 [[nodiscard]] static constexpr bool returnableValue(Pred const&, Value const&) noexcept
74 {
75 return Negated;
76 }
77
78 template <class Tree>
79 [[nodiscard]] static constexpr bool returnable(Pred const&, Tree const&,
80 typename Tree::Node const&) noexcept
81 {
82 return Negated;
83 }
84
85 template <class Tree>
86 [[nodiscard]] static constexpr bool traversable(Pred const&, Tree const&,
87 typename Tree::Node const&) noexcept
88 {
89 return Negated;
90 }
91
92 template <class Tree>
93 [[nodiscard]] static constexpr bool returnableRay(Pred const&, Tree const&,
94 typename Tree::Node const&,
95 typename Tree::Ray const&) noexcept
96 {
97 return Negated;
98 }
99
100 template <class Tree>
101 [[nodiscard]] static constexpr bool traversableRay(Pred const&, Tree const&,
102 typename Tree::Node const&,
103 typename Tree::Ray const&) noexcept
104 {
105 return Negated;
106 }
107};
108} // namespace ufo::pred
109
110#endif // UFO_CONTAINER_TREE_PREDICATE_BOOLEAN_HPP
Utilizing curiously recurring template pattern (CRTP)
Definition tree.hpp:104