aboutsummaryrefslogtreecommitdiffhomepage
path: root/Eigen/src/Core/util/Meta.h
diff options
context:
space:
mode:
authorGravatar Christoph Hertzberg <chtz@informatik.uni-bremen.de>2014-07-04 12:52:55 +0200
committerGravatar Christoph Hertzberg <chtz@informatik.uni-bremen.de>2014-07-04 12:52:55 +0200
commitf36538049669a7efee57f2b1e3c60bf8bf3976bb (patch)
tree1a2194d24455a1cab7ff3c657f4b6fb21ec5d3da /Eigen/src/Core/util/Meta.h
parent3a9f9faada5de3a13611d7543014c5ef503eff58 (diff)
Fix regression introduced by 3117036b80075390dbc46f60aa0d595e5a44661b
: Matrix<Scalar,1,1>(int) did not compile if Scalar is not constructible from int. Now this falls back to the (Index size) constructor.
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 e4e4d4a87..795197f59 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.
*/