13 #include "../base/type_traits.h" 34 template <
class T>
struct inner {
51 using result = detail::result;
61 : idx{0}, outcome{rhs.outcome} {}
70 : idx{mpl::type_list_index_v<T, list>}, outcome{result::sibling} {}
74 : idx{mpl::type_list_index_v<T, list>}, outcome{result::inner} {}
78 : idx{mpl::type_list_index_v<T, list>}, outcome{result::inner_entry} {}
87 : idx{mpl::type_list_index_v<T, list>}, outcome{rhs.outcome} {}
95 : idx{mpl::type_list_index_v<detail::none, list>}, outcome{result::none} {
104 : idx{mpl::type_list_index_v<detail::none, list>}, outcome{result::none} {
113 bool is_sibling()
const {
return outcome == result::sibling; }
115 bool is_inner()
const {
return outcome == result::inner; }
117 bool is_inner_entry()
const {
return outcome == result::inner_entry; }
123 bool is_none()
const {
return outcome == result::none; }
127 std::size_t
const idx;
128 result
const outcome;
140 template <
class S>
inline auto inner() {
144 template <
class S>
inline auto inner_entry() {
160 template <std::
size_t Index,
class Transition>
161 using transition_t = mpl::type_list_element_t<Index, typename Transition::list>;
170 template <
class Transition,
class Func, std::size_t... Is>
172 std::index_sequence<Is...>) {
173 (func(std::integral_constant<std::size_t, Is>{}, t), ...);
184 template <
class... T,
class Func>
188 std::make_index_sequence<
sizeof...(T)>{});
transitions(transitions< T > const &rhs) noexcept
Constructs a new transitions object from another transitions object.
Definition: transition.h:86
Tag type indicating no transition.
Definition: transition.h:24
transitions(detail::sibling< T >) noexcept
Constructs a new transitions object from a detail::transition type.
Definition: transition.h:69
Definition: transition.h:38
constexpr transitions(transitions< T... > const &rhs) noexcept
Constructs a new transitions object from another transitions object.
Definition: transition.h:60
Definition: transition.h:34
Class representing a collection of transitions.
Definition: transition.h:50
mpl::type_list_element_t< Index, typename Transition::list > transition_t
Type alias for the transition type at a specific index.
Definition: transition.h:161
auto sibling()
Helper function for creating a transition object.
Definition: transition.h:136
transitions(transitions< detail::none >) noexcept
Constructs a new transitions object indicating that the event was handled.
Definition: transition.h:103
Helper struct for defining a transition type.
Definition: transition.h:30
bool is_transition() const
Checks if this object represents a transition.
Definition: transition.h:111
bool is_none() const
Checks if the event was handled.
Definition: transition.h:123
constexpr void for_each_transition(transitions< T... > const &trans, Func &&func)
Helper function for iterating over each transition in a transitions object.
Definition: transition.h:185
transitions(detail::none) noexcept
Constructs a new transitions object with no transition.
Definition: transition.h:94
Definition: compressed_pair.h:10
Alias template to facilitate the creation of named values.
Definition: type_traits.h:142
constexpr void for_each_transition_impl(Transition &&t, Func &&func, std::index_sequence< Is... >)
Helper function for getting the transition type at a specific index.
Definition: transition.h:171
auto none()
Helper function for creating a transitions object indicating that the event was not handled...
Definition: transition.h:153