Struct state_fn

Struct Documentation

struct state_fn

Customization point object type for accessing the state of a particle.

See https://en.cppreference.com/w/cpp/ranges/cpo.

Public Functions

template<class T, std::enable_if_t<std::conjunction_v<has_member_variable_state<T>, std::negation<has_member_state<T>>, std::negation<has_non_member_state<T>>>, int> = 0>
inline constexpr decltype(auto) operator()(T &&t) const noexcept

Overload for when the particle type defines a member variable.

template<class T, std::enable_if_t<std::conjunction_v<std::negation<has_member_variable_state<T>>, has_member_state<T>, std::negation<has_non_member_state<T>>>, int> = 0>
inline constexpr decltype(auto) operator()(T &&t) const noexcept(noexcept(std::forward<T>(t).state()))

Overload for when the particle type defines a member method.

template<class T, std::enable_if_t<std::conjunction_v<std::negation<has_member_variable_state<T>>, std::negation<has_member_state<T>>, has_non_member_state<T>>, int> = 0>
inline constexpr decltype(auto) operator()(T &&t) const noexcept(noexcept(state(std::forward<T>(t))))

Overload for when there is an external function that takes this particle type.

The non-member function must be in T’s namespace so it can be found by ADL.

template<class T, std::enable_if_t<std::conjunction_v<std::negation<has_member_variable_state<T>>, std::negation<has_member_state<T>>, std::negation<has_non_member_state<T>>, is_tuple_like<T>>, int> = 0, std::enable_if_t<(std::tuple_size_v<std::decay_t<T>> > 1), int> = 0>
inline constexpr decltype(auto) operator()(T &&t) const noexcept(noexcept(std::get<0>(std::forward<T>(t))))

Overload for tuple-like types.

Assumes that the first element is the state.