From b0e4c31443f2867ccd1b988f50c0eb995ff70db2 Mon Sep 17 00:00:00 2001 From: bergmann Date: Fri, 13 Sep 2019 09:37:15 +0200 Subject: [PATCH] * Fixed different bugs * setter implementation has defined wrong types * is_valid did never evaluate to false_t --- include/cppmp/core/checker.h | 2 +- include/cppmp/core/checker.inl | 12 ++++++- include/cppmp/misc/setter.inl | 4 +-- include/cppmp/traits/lambda_traits.inl | 49 -------------------------- 4 files changed, 14 insertions(+), 53 deletions(-) diff --git a/include/cppmp/core/checker.h b/include/cppmp/core/checker.h index fc8876a..6709161 100644 --- a/include/cppmp/core/checker.h +++ b/include/cppmp/core/checker.h @@ -17,7 +17,7 @@ namespace cppmp /** * @brief Evaluates to true_t if the passed template parameters are valid, false_t otherwise. */ - template + template struct is_valid; /** diff --git a/include/cppmp/core/checker.inl b/include/cppmp/core/checker.inl index 08f84d4..d5af25c 100644 --- a/include/cppmp/core/checker.inl +++ b/include/cppmp/core/checker.inl @@ -29,8 +29,18 @@ namespace cppmp /* is_valid */ - template + template struct is_valid + : public false_t + { }; + + template + struct is_valid> + : public true_t + { }; + + template<> + struct is_valid : public true_t { }; diff --git a/include/cppmp/misc/setter.inl b/include/cppmp/misc/setter.inl index f9ecf99..f45047b 100644 --- a/include/cppmp/misc/setter.inl +++ b/include/cppmp/misc/setter.inl @@ -140,8 +140,8 @@ namespace cppmp { using lambda_type = T_lambda; using lambda_traits_type = lambda_traits; - using object_type = typename lambda_traits_type::template argument_t<0>; - using value_type = typename lambda_traits_type::return_type; + using object_type = decay_t>; + using value_type = decay_t>; lambda_type lambda; diff --git a/include/cppmp/traits/lambda_traits.inl b/include/cppmp/traits/lambda_traits.inl index 2cddbc3..7387c04 100644 --- a/include/cppmp/traits/lambda_traits.inl +++ b/include/cppmp/traits/lambda_traits.inl @@ -62,52 +62,3 @@ namespace cppmp { }; } - - - - - - - -#pragma once -#include -#include - -namespace stx -{ - - namespace lambda_detail - { - template - struct types - { - using is_mutable = IsMutable; - - enum { arity = sizeof...(Args) }; - - using return_type = Ret; - - template - struct arg - { - typedef typename std::tuple_element>::type type; - }; - }; - } - - template - struct lambda_type - : lambda_type - {}; - - template - struct lambda_type - : lambda_detail::types - {}; - - template - struct lambda_type - : lambda_detail::types - {}; - -};