1 #ifndef DASH__META_H__INCLUDED 2 #define DASH__META_H__INCLUDED 4 #include <dash/Types.h> 5 #include <dash/meta/TypeInfo.h> 12 #define DASH__META__DEFINE_TRAIT__HAS_TYPE(DepType) \ 13 template<typename T> \ 14 struct has_type_##DepType { \ 17 typedef struct { char array[2]; } no; \ 18 template<typename C> static yes test(typename C:: DepType *); \ 19 template<typename C> static no test(...); \ 21 static constexpr bool value = sizeof(test<T>(0)) == sizeof(yes); \ 33 template<
class Cond0,
class... CondN>
37 conjunction<CondN...>,
48 DASH__META__DEFINE_TRAIT__HAS_TYPE(iterator)
54 DASH__META__DEFINE_TRAIT__HAS_TYPE(const_iterator)
60 DASH__META__DEFINE_TRAIT__HAS_TYPE(reference)
66 DASH__META__DEFINE_TRAIT__HAS_TYPE(const_reference)
72 DASH__META__DEFINE_TRAIT__HAS_TYPE(value_type)
77 #include <type_traits> 93 using reference_t =
typename std::add_lvalue_reference<I>::type;
96 using rvalue_reference_t =
97 decltype(std::move(std::declval<dash::reference_t<I>>()));
107 template<
typename T>
struct adv {
109 explicit adv(T && value) : _value(std::forward<T>(value)) {}
110 template<
typename ...U> T && operator()(U &&...) {
111 return std::forward<T>(_value);
115 template<
typename T> adv<T> make_adv(T && value) {
116 return adv<T> { std::forward<T>(value) };
122 namespace functional {
129 template <
typename T>
130 struct closure_traits : closure_traits<decltype(&T::operator())> {
133 #define REM_CTOR(...) __VA_ARGS__ 134 #define SPEC(cv, var, is_var) \ 135 template <typename C, typename R, typename... Args> \ 136 struct closure_traits<R (C::*)(Args... REM_CTOR var) cv> { \ 137 using arity = std::integral_constant<std::size_t, sizeof...(Args)>; \ 138 using is_variadic = std::integral_constant<bool, is_var>; \ 139 using is_const = std::is_const<int cv>; \ 141 using result_type = R; \ 143 template <std::size_t i> \ 144 using arg = typename std::tuple_element<i, std::tuple<Args...>>::type; \ 147 SPEC(
const, (, ...), 1)
158 struct is_bind_expression< dash::adv<T> > : std::true_type {};
163 #endif // DASH__META_H__INCLUDED This class is a simple memory pool which holds allocates elements of size ValueType.
see https://en.cppreference.com/w/cpp/feature_test for recommended feature tests