mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-01-30 17:40:05 +08:00
Make sure sizeof is truelly needed, thus improving SFINAE portability.
This commit is contained in:
parent
84cf6e42ca
commit
836fa25a82
@ -381,13 +381,13 @@ struct has_ReturnType
|
||||
enum { value = sizeof(testFunctor<T>(0)) == sizeof(meta_yes) };
|
||||
};
|
||||
|
||||
template<int Val> struct integral_constant { static const int value = Val; };
|
||||
template<int Size> struct meta_array { int a[Size]; };
|
||||
template<typename T> const T& return_ref();
|
||||
|
||||
template <typename T>
|
||||
struct has_nullary_operator
|
||||
{
|
||||
template <typename C> static meta_yes testFunctor(C const *,integral_constant< sizeof(return_ref<C>()()) > * = 0);
|
||||
template <typename C> static meta_yes testFunctor(C const *,meta_array< sizeof(return_ref<C>()()) > * = 0);
|
||||
static meta_no testFunctor(...);
|
||||
|
||||
enum { value = sizeof(testFunctor(static_cast<T*>(0))) == sizeof(meta_yes) };
|
||||
@ -396,7 +396,7 @@ struct has_nullary_operator
|
||||
template <typename T>
|
||||
struct has_unary_operator
|
||||
{
|
||||
template <typename C> static meta_yes testFunctor(C const *,integral_constant< sizeof(return_ref<C>()(Index(0))) > * = 0);
|
||||
template <typename C> static meta_yes testFunctor(C const *,meta_array< sizeof(return_ref<C>()(Index(0))) > * = 0);
|
||||
static meta_no testFunctor(...);
|
||||
|
||||
enum { value = sizeof(testFunctor(static_cast<T*>(0))) == sizeof(meta_yes) };
|
||||
@ -405,7 +405,7 @@ struct has_unary_operator
|
||||
template <typename T>
|
||||
struct has_binary_operator
|
||||
{
|
||||
template <typename C> static meta_yes testFunctor(C const *,integral_constant< sizeof(return_ref<C>()(Index(0),Index(0))) > * = 0);
|
||||
template <typename C> static meta_yes testFunctor(C const *,meta_array< sizeof(return_ref<C>()(Index(0),Index(0))) > * = 0);
|
||||
static meta_no testFunctor(...);
|
||||
|
||||
enum { value = sizeof(testFunctor(static_cast<T*>(0))) == sizeof(meta_yes) };
|
||||
|
Loading…
Reference in New Issue
Block a user