Simplify ScalarBinaryOpTraits by removing the Defined enum, and extend its documentation.

This commit is contained in:
Gael Guennebaud
2016-07-20 09:56:39 +02:00
parent e3bf874c83
commit 4b4c296d6e
4 changed files with 45 additions and 16 deletions

View File

@@ -358,6 +358,19 @@ struct result_of<Func(ArgType0,ArgType1,ArgType2)> {
};
#endif
// Check whether T::ReturnType does exist
template <typename T>
struct has_ReturnType
{
typedef char yes[1];
typedef char no[2];
template <typename C> static yes& testFunctor(C const *, typename C::ReturnType const * = 0);
static no& testFunctor(...);
static const bool value = sizeof(testFunctor(static_cast<T*>(0))) == sizeof(yes);
};
/** \internal In short, it computes int(sqrt(\a Y)) with \a Y an integer.
* Usage example: \code meta_sqrt<1023>::ret \endcode
*/