7#ifndef MAKI_STATE_SET_HPP
8#define MAKI_STATE_SET_HPP
10#include "state_mold.hpp"
11#include "detail/friendly_impl.hpp"
12#include "detail/set.hpp"
27 constexpr auto make_state_set_from_impl(
const Impl& impl)
29 return state_set<Impl>{impl};
37 constexpr state_set(
const state_set& other) =
default;
38 constexpr state_set(state_set&& other) =
default;
40 ~state_set() =
default;
42 constexpr state_set& operator=(
const state_set& other) =
default;
43 constexpr state_set& operator=(state_set&& other) =
default;
46 MAKI_DETAIL_FRIENDLY_IMPL
48 using impl_type = Impl;
51 friend constexpr auto detail::make_state_set_from_impl(
const Impl2&);
53 explicit constexpr state_set(
const Impl& impl):
61#ifdef MAKI_DETAIL_DOXYGEN
68inline constexpr auto all_states = detail::make_state_set_from_impl
70 detail::make_set_including_all()
74#ifdef MAKI_DETAIL_DOXYGEN
79inline constexpr auto no_state = IMPLEMENTATION_DETAIL;
81inline constexpr auto no_state = detail::make_state_set_from_impl
83 detail::make_set_excluding_all()
93constexpr auto operator!(
const state_set<Impl>& stt_set)
95 return detail::make_state_set_from_impl
97 detail::inverse_set(detail::impl_of(stt_set))
106template<
class StateMoldImpl>
109 return detail::make_state_set_from_impl
111 detail::make_set_excluding(&stt_mold)
120template<
class LhsImpl,
class RhsImpl>
121constexpr auto operator||
123 const state_set<LhsImpl>& lhs,
124 const state_set<RhsImpl>& rhs
127 return detail::make_state_set_from_impl
129 detail::make_set_union(detail::impl_of(lhs), detail::impl_of(rhs))
138template<
class StateSetImpl,
class StateMoldImpl>
139constexpr auto operator||
141 const state_set<StateSetImpl>& stt_set,
145 return detail::make_state_set_from_impl
147 detail::make_set_union(detail::impl_of(stt_set), &stt_mold)
156template<
class StateMoldImpl,
class StateSetImpl>
157constexpr auto operator||
160 const state_set<StateSetImpl>& stt_set
163 return stt_set || stt_mold;
171template<
class LhsStateMoldImpl,
class RhsStateMoldImpl>
172constexpr auto operator||
178 return detail::make_state_set_from_impl
180 detail::make_set_including(&lhs, &rhs)
189template<
class LhsImpl,
class RhsImpl>
190constexpr auto operator&&
192 const state_set<LhsImpl>& lhs,
193 const state_set<RhsImpl>& rhs
196 return detail::make_state_set_from_impl
198 detail::make_set_intersection(detail::impl_of(lhs) && detail::impl_of(rhs))
204 template<
class StateMoldImpl,
class StateMoldImpl2>
207 return equals(&lhs, rhs);
210 template<
class StateMoldImpl,
class... Predicates>
211 constexpr bool contained_in(
const state_mold<StateMoldImpl>& stt_mold,
const state_set<Predicates>&... state_sets)
213 return (contains(impl_of(state_sets), &stt_mold) || ...);
219 static constexpr auto value =
false;
222 template<
class Predicate>
223 struct is_state_set<state_set<Predicate>>
225 static constexpr auto value =
true;
229 constexpr auto is_state_set_v = is_state_set<T>::value;
State mold.
Definition state_mold.hpp:43
Represents a state set.
Definition state_set.hpp:35
constexpr auto no_state
An empty maki::state_set.
Definition state_set.hpp:79
constexpr auto operator!(const state_mold< StateMoldImpl > &stt_mold)
Creates a maki::state_set that contains all the states but the ones created by stt_mold.
Definition state_set.hpp:107
constexpr auto all_states
An infinite maki::state_set that contains all the states.
Definition state_set.hpp:66
constexpr auto operator!(const state_set< Impl > &stt_set)
Creates a maki::state_set that contains all the states that are not contained in stt_set.
Definition state_set.hpp:93