autoppl
v0.8
A C++ template library for probabilistic programming
|
Go to the documentation of this file.
66 #define DEFINE_HAS_TYPE(name) \
69 struct has_type_##name \
72 template<typename V> static void impl(typename V::name*); \
73 template<typename V> static bool impl(...); \
75 static constexpr bool value = std::is_same<void, decltype(impl<T>(0))>::value; \
78 template <class T, bool = false> \
79 struct get_type_##name \
81 using type = invalid_tag; \
84 struct get_type_##name<T, true> \
86 using type = typename T::name; \
90 struct assert_has_type_##name \
92 static_assert(b, "Type does not have member type "#name); \
96 struct assert_has_type_##name<true> : std::true_type \
100 inline constexpr bool has_type_##name##_v = \
101 details::has_type_##name<T>::value; \
103 inline constexpr bool assert_has_type_##name##_v = \
104 details::assert_has_type_##name<has_type_##name##_v<T>>::value; \
106 using get_type_##name##_t = \
107 typename details::get_type_##name<T, has_type_##name##_v<T>>::type;
159 #define DEFINE_HAS_FUNC(name) \
160 namespace details { \
162 struct has_func_##name \
165 template<typename V> static void impl(decltype(&V::name)); \
166 template<typename V> static bool impl(...); \
168 static constexpr bool value = std::is_same<void, decltype(impl<T>(0))>::value; \
172 struct assert_has_func_##name \
175 "Type does not have public, non-overloaded " \
176 "member function "#name \
181 struct assert_has_func_##name<true> : std::true_type \
185 inline constexpr bool has_func_##name##_v = \
186 details::has_func_##name<T>::value; \
188 inline constexpr bool assert_has_func_##name##_v = \
189 details::assert_has_func_##name<has_func_##name##_v<T>>::value; \
227 #undef DEFINE_HAS_FUNC
228 #undef DEFINE_HAS_TYPE
invalid_tag(invalid_tag &&)=delete
invalid_tag & operator=(const invalid_tag &)=delete
invalid_tag & operator=(invalid_tag &&)=delete
invalid_tag(const invalid_tag &)=delete
constexpr size_t size(const T &x)
Definition: value.hpp:22
double dist_value_t
Definition: dist_expr_traits.hpp:13
Definition: bounded.hpp:11
Definition: concept.hpp:199