aboutsummaryrefslogtreecommitdiffhomepage
path: root/Eigen/src/Core/util/Meta.h
diff options
context:
space:
mode:
authorGravatar Gael Guennebaud <g.gael@free.fr>2014-07-10 22:04:45 +0200
committerGravatar Gael Guennebaud <g.gael@free.fr>2014-07-10 22:04:45 +0200
commit296cb4016124d5c186ed65637888bb1c2c5fda2f (patch)
treef232c9aa62f8c581c7348226dc732d45d397a818 /Eigen/src/Core/util/Meta.h
parent61b88d2feb8f23d1ba122f2c9a73abb183ebb25d (diff)
parentd1460d92782ce0f7b90a8a52d44d50b44b167f98 (diff)
merge with default branch
Diffstat (limited to 'Eigen/src/Core/util/Meta.h')
-rw-r--r--Eigen/src/Core/util/Meta.h19
1 files changed, 19 insertions, 0 deletions
diff --git a/Eigen/src/Core/util/Meta.h b/Eigen/src/Core/util/Meta.h
index 559928a92..c578b6c86 100644
--- a/Eigen/src/Core/util/Meta.h
+++ b/Eigen/src/Core/util/Meta.h
@@ -80,6 +80,25 @@ template<typename T> struct add_const_on_value_type<T*> { typedef T const
template<typename T> struct add_const_on_value_type<T* const> { typedef T const* const type; };
template<typename T> struct add_const_on_value_type<T const* const> { typedef T const* const type; };
+
+template<typename From, typename To>
+struct is_convertible
+{
+private:
+ struct yes {int a[1];};
+ struct no {int a[2];};
+
+ template<typename T>
+ static yes test (const T&) {}
+
+ template<typename> static no test (...) {}
+
+public:
+ static From ms_from;
+ enum { value = sizeof(test<To>(ms_from))==sizeof(yes) };
+};
+
+
/** \internal Allows to enable/disable an overload
* according to a compile time condition.
*/