Explorar el Código

* Fixed different bugs

* setter implementation has defined wrong types
    * is_valid did never evaluate to false_t
master
bergmann hace 6 años
padre
commit
b0e4c31443
Se han modificado 4 ficheros con 14 adiciones y 53 borrados
  1. +1
    -1
      include/cppmp/core/checker.h
  2. +11
    -1
      include/cppmp/core/checker.inl
  3. +2
    -2
      include/cppmp/misc/setter.inl
  4. +0
    -49
      include/cppmp/traits/lambda_traits.inl

+ 1
- 1
include/cppmp/core/checker.h Ver fichero

@@ -17,7 +17,7 @@ namespace cppmp
/**
* @brief Evaluates to true_t if the passed template parameters are valid, false_t otherwise.
*/
template<typename...>
template<typename T, typename = void>
struct is_valid;

/**


+ 11
- 1
include/cppmp/core/checker.inl Ver fichero

@@ -29,8 +29,18 @@ namespace cppmp

/* is_valid */

template<typename...>
template<typename T, typename>
struct is_valid
: public false_t
{ };

template<typename T>
struct is_valid<T, void_t<decltype(sizeof(T))>>
: public true_t
{ };

template<>
struct is_valid<void, void>
: public true_t
{ };



+ 2
- 2
include/cppmp/misc/setter.inl Ver fichero

@@ -140,8 +140,8 @@ namespace cppmp
{
using lambda_type = T_lambda;
using lambda_traits_type = lambda_traits<lambda_type>;
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<typename lambda_traits_type::template argument_t<0>>;
using value_type = decay_t<typename lambda_traits_type::template argument_t<1>>;

lambda_type lambda;



+ 0
- 49
include/cppmp/traits/lambda_traits.inl Ver fichero

@@ -62,52 +62,3 @@ namespace cppmp
{ };

}







#pragma once
#include <tuple>
#include <type_traits>

namespace stx
{

namespace lambda_detail
{
template<class Ret, class Cls, class IsMutable, class... Args>
struct types
{
using is_mutable = IsMutable;

enum { arity = sizeof...(Args) };

using return_type = Ret;

template<size_t i>
struct arg
{
typedef typename std::tuple_element<i, std::tuple<Args...>>::type type;
};
};
}

template<class Ld>
struct lambda_type
: lambda_type<decltype(&Ld::operator())>
{};

template<class Ret, class Cls, class... Args>
struct lambda_type<Ret(Cls::*)(Args...)>
: lambda_detail::types<Ret,Cls,std::true_type,Args...>
{};

template<class Ret, class Cls, class... Args>
struct lambda_type<Ret(Cls::*)(Args...) const>
: lambda_detail::types<Ret,Cls,std::false_type,Args...>
{};

};

Cargando…
Cancelar
Guardar