Go to the documentation of this file.
15 #ifndef BELUGA_TYPE_TRAITS_PARTICLE_TRAITS_HPP
16 #define BELUGA_TYPE_TRAITS_PARTICLE_TRAITS_HPP
20 #include <range/v3/range/traits.hpp>
33 using state_type = std::decay_t<decltype(beluga::state(std::declval<T>()))>;
35 using weight_type = std::decay_t<decltype(beluga::weight(std::declval<T>()))>;
48 template <
class T,
class =
void>
49 struct has_state :
public std::false_type {};
52 struct has_state<T,
std::void_t<decltype(beluga::state(std::declval<T>()))>> : std::true_type {};
55 inline constexpr
bool has_state_v = has_state<T>::value;
57 template <
class T,
class =
void>
58 struct has_weight :
public std::false_type {};
61 struct has_weight<T,
std::void_t<decltype(beluga::weight(std::declval<T>()))>> : std::true_type {};
64 inline constexpr
bool has_weight_v = has_weight<T>::value;
66 template <
class T,
class =
void>
67 struct is_particle :
public std::false_type {};
70 struct is_particle<T,
std::
enable_if_t<std::conjunction_v<has_state<T>, has_weight<T>>>> : std::true_type {};
73 inline constexpr
bool is_particle_v = is_particle<T>::value;
76 inline constexpr
bool is_particle_range_v = is_particle_v<ranges::range_value_t<R>>;
83 template <
class Particle,
class State = state_t<Particle>>
93 static_assert(is_particle_v<Particle>);
94 auto particle = []() {
95 if constexpr (is_tuple_like_v<Particle>) {
119 template <
class Particle>
Implementation of library primitives to abstract member access.
std::decay_t< decltype(beluga::weight(std::declval< T >()))> weight_type
The particle weight type.
Common traits of all particle types. See Page requirements as well.
constexpr state_detail::state_fn state
Customization point object for accessing the state of a particle.
typename std::enable_if< B, T >::type enable_if_t
constexpr weight_detail::weight_fn weight
Customization point object for accessing the weight of a particle.
typename particle_traits< T >::weight_type weight_t
Type trait that returns the weight type given a particle type.
std::decay_t< decltype(beluga::state(std::declval< T >()))> state_type
The particle state type.
constexpr auto operator()(State value) const
Returns a new particle from the given state.
constexpr detail::make_from_state_fn< Particle > make_from_state
A function object to create a particle from a given state.
Implementation of traits for tuple-like types.
Function object type to create a particle from a given state.
typename decay_tuple_like< T >::type decay_tuple_like_t
Convenience template type alias for decay_tuple_like.
typename particle_traits< T >::state_type state_t
Type trait that returns the state type given a particle type.
The main Beluga namespace.
beluga
Author(s):
autogenerated on Tue Jul 16 2024 02:59:53