sfinae_utility.hpp
Go to the documentation of this file.00001
00025 #ifndef __MLPACK_CORE_SFINAE_UTILITY
00026 #define __MLPACK_CORE_SFINAE_UTILITY
00027
00028 #include <boost/utility/enable_if.hpp>
00029 #include <boost/type_traits.hpp>
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050 #define HAS_MEM_FUNC(FUNC, NAME) \
00051 template<typename T, typename sig> \
00052 struct NAME { \
00053 typedef char yes[1]; \
00054 typedef char no [2]; \
00055 template<typename U, U> struct type_check; \
00056 template<typename _1> static yes &chk(type_check<sig, &_1::FUNC> *); \
00057 template<typename > static no &chk(...); \
00058 static bool const value = sizeof(chk<T>(0)) == sizeof(yes); \
00059 };
00060
00061 #endif