mirror of
https://gitlab.com/libeigen/eigen.git
synced 2024-12-21 07:19:46 +08:00
Implement result_of for the new ternary functors
This commit is contained in:
parent
df24f4a01d
commit
33f0340188
@ -328,6 +328,30 @@ struct result_of<Func(ArgType0,ArgType1)> {
|
||||
enum {FunctorType = sizeof(testFunctor(static_cast<Func*>(0)))};
|
||||
typedef typename binary_result_of_select<Func, ArgType0, ArgType1, FunctorType>::type type;
|
||||
};
|
||||
|
||||
template<typename Func, typename ArgType0, typename ArgType1, typename ArgType2, int SizeOf=sizeof(has_none)>
|
||||
struct ternary_result_of_select {typedef typename internal::remove_all<ArgType0>::type type;};
|
||||
|
||||
template<typename Func, typename ArgType0, typename ArgType1, typename ArgType2>
|
||||
struct ternary_result_of_select<Func, ArgType0, ArgType1, ArgType2, sizeof(has_std_result_type)>
|
||||
{typedef typename Func::result_type type;};
|
||||
|
||||
template<typename Func, typename ArgType0, typename ArgType1, typename ArgType2>
|
||||
struct ternary_result_of_select<Func, ArgType0, ArgType1, ArgType2, sizeof(has_tr1_result)>
|
||||
{typedef typename Func::template result<Func(ArgType0,ArgType1,ArgType2)>::type type;};
|
||||
|
||||
template<typename Func, typename ArgType0, typename ArgType1, typename ArgType2>
|
||||
struct result_of<Func(ArgType0,ArgType1,ArgType2)> {
|
||||
template<typename T>
|
||||
static has_std_result_type testFunctor(T const *, typename T::result_type const * = 0);
|
||||
template<typename T>
|
||||
static has_tr1_result testFunctor(T const *, typename T::template result<T(ArgType0,ArgType1,ArgType2)>::type const * = 0);
|
||||
static has_none testFunctor(...);
|
||||
|
||||
// note that the following indirection is needed for gcc-3.3
|
||||
enum {FunctorType = sizeof(testFunctor(static_cast<Func*>(0)))};
|
||||
typedef typename ternary_result_of_select<Func, ArgType0, ArgType1, ArgType2, FunctorType>::type type;
|
||||
};
|
||||
#endif
|
||||
|
||||
/** \internal In short, it computes int(sqrt(\a Y)) with \a Y an integer.
|
||||
|
Loading…
Reference in New Issue
Block a user