Commit 07612387 authored by Florian Maurin's avatar Florian Maurin Committed by Rasmus Munk Larsen
Browse files

Core: Simplify callable detection

parent 5ee913f0
Loading
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -148,8 +148,7 @@ static EIGEN_ALWAYS_INLINE void scalar_tail_pack(float* EIGEN_RESTRICT dst_panel
template <typename DataMapper, typename EnableIf = void>
struct sme_has_incr : std::false_type {};
template <typename DataMapper>
struct sme_has_incr<DataMapper, std::enable_if_t<(sizeof(decltype(std::declval<const DataMapper&>().incr())) > 0)>>
    : std::true_type {};
struct sme_has_incr<DataMapper, void_t<decltype(std::declval<const DataMapper&>().incr())>> : std::true_type {};

template <typename Index, typename DataMapper>
EIGEN_ALWAYS_INLINE std::enable_if_t<sme_has_incr<DataMapper>::value, Index> sme_mapper_incr(const DataMapper& m) {
+3 −7
Original line number Diff line number Diff line
@@ -311,23 +311,19 @@ template <typename T, typename IndexType = Index, typename EnableIf = void>
struct has_nullary_operator : std::false_type {};

template <typename T, typename IndexType>
struct has_nullary_operator<T, IndexType, std::enable_if_t<(sizeof(decltype(std::declval<const T&>()())) > 0)>>
    : std::true_type {};
struct has_nullary_operator<T, IndexType, void_t<decltype(std::declval<const T&>()())>> : std::true_type {};

template <typename T, typename IndexType = Index, typename EnableIf = void>
struct has_unary_operator : std::false_type {};

template <typename T, typename IndexType>
struct has_unary_operator<T, IndexType,
                          std::enable_if_t<(sizeof(decltype(std::declval<const T&>()(IndexType(0)))) > 0)>>
    : std::true_type {};
struct has_unary_operator<T, IndexType, void_t<decltype(std::declval<const T&>()(IndexType(0)))>> : std::true_type {};

template <typename T, typename IndexType = Index, typename EnableIf = void>
struct has_binary_operator : std::false_type {};

template <typename T, typename IndexType>
struct has_binary_operator<
    T, IndexType, std::enable_if_t<(sizeof(decltype(std::declval<const T&>()(IndexType(0), IndexType(0)))) > 0)>>
struct has_binary_operator<T, IndexType, void_t<decltype(std::declval<const T&>()(IndexType(0), IndexType(0)))>>
    : std::true_type {};

/** \internal Computes the least common multiple of two positive integer A and B