diff --git a/Eigen/src/Core/util/Meta.h b/Eigen/src/Core/util/Meta.h index 28d7189b5..0cf0ccc04 100644 --- a/Eigen/src/Core/util/Meta.h +++ b/Eigen/src/Core/util/Meta.h @@ -59,16 +59,11 @@ template struct remove_const { typedef T type; }; template struct remove_const { typedef T type[]; }; template struct remove_const { typedef T type[Size]; }; -template struct remove_const_on_value_type { typedef T type; }; -template struct remove_const_on_value_type { typedef T type; }; -template struct remove_const_on_value_type { typedef T & type; }; -template struct remove_const_on_value_type { typedef T * type; }; - template struct remove_all { typedef T type; }; template struct remove_all { typedef typename remove_all::type type; }; -template struct remove_all { typedef typename remove_all::type type; }; +template struct remove_all { typedef typename remove_all::type type; }; template struct remove_all { typedef typename remove_all::type type; }; -template struct remove_all { typedef typename remove_all::type type; }; +template struct remove_all { typedef typename remove_all::type type; }; template struct remove_all { typedef typename remove_all::type type; }; template struct is_arithmetic { enum { value = false }; }; @@ -94,7 +89,8 @@ template struct add_const { typedef T& type; }; template struct add_const_on_value_type { typedef const T type; }; template struct add_const_on_value_type { typedef T const& type; }; template struct add_const_on_value_type { typedef T const* type; }; -template struct add_const_on_value_type { typedef const T* const type; }; +template struct add_const_on_value_type { typedef T const* const type; }; +template struct add_const_on_value_type { typedef T const* const type; }; template struct makeconst_return_type { diff --git a/test/meta.cpp b/test/meta.cpp index 2c3c2985a..e8c95920b 100644 --- a/test/meta.cpp +++ b/test/meta.cpp @@ -43,11 +43,27 @@ void test_meta() VERIFY(( internal::is_same::type >::value)); VERIFY(( internal::is_same::type >::value)); - VERIFY(( internal::is_same::type >::value)); - VERIFY(( internal::is_same::type >::value)); - VERIFY(( internal::is_same::type >::value)); + // test add_const + VERIFY(( internal::is_same< internal::add_const::type, const float >::value)); + VERIFY(( internal::is_same< internal::add_const::type, float* const>::value)); + VERIFY(( internal::is_same< internal::add_const::type, float const* const>::value)); + VERIFY(( internal::is_same< internal::add_const::type, float& >::value)); + + // test remove_const + VERIFY(( internal::is_same< internal::remove_const::type, float const* >::value)); + VERIFY(( internal::is_same< internal::remove_const::type, float const* >::value)); + VERIFY(( internal::is_same< internal::remove_const::type, float* >::value)); + + // test add_const_on_value_type + VERIFY(( internal::is_same< internal::add_const_on_value_type::type, float const& >::value)); + VERIFY(( internal::is_same< internal::add_const_on_value_type::type, float const* >::value)); + + VERIFY(( internal::is_same< internal::add_const_on_value_type::type, const float >::value)); + VERIFY(( internal::is_same< internal::add_const_on_value_type::type, const float >::value)); + + VERIFY(( internal::is_same< internal::add_const_on_value_type::type, const float* const>::value)); + VERIFY(( internal::is_same< internal::add_const_on_value_type::type, const float* const>::value)); - VERIFY(( internal::is_same::type >::value)); VERIFY(( internal::is_same::type >::value)); VERIFY(( internal::is_same::type >::value)); VERIFY(( internal::is_same::type >::value));