diff --git a/include/boost/numeric/odeint/algebra/detail/extract_value_type.hpp b/include/boost/numeric/odeint/algebra/detail/extract_value_type.hpp index c5246bb6f..8d4340dfa 100644 --- a/include/boost/numeric/odeint/algebra/detail/extract_value_type.hpp +++ b/include/boost/numeric/odeint/algebra/detail/extract_value_type.hpp @@ -18,7 +18,10 @@ #define BOOST_NUMERIC_ODEINT_ALGEBRA_DETAIL_EXTRACT_VALUE_TYPE_HPP_INCLUDED #include +#include +#include #include +#include BOOST_MPL_HAS_XXX_TRAIT_DEF(value_type) @@ -28,24 +31,20 @@ namespace odeint { namespace detail { template< typename S , typename Enabler = void > -struct extract_value_type {}; - -// as long as value_types are defined we go down the value_type chain -// e.g. returning S::value_type::value_type::value_type - -template< typename S > -struct extract_value_type >::type > +struct extract_value_type { - // no value_type defined, return S typedef S type; }; +// as long as value_types are defined we go down the value_type chain +// e.g. returning S::value_type::value_type::value_type + template< typename S > struct extract_value_type< S , typename boost::enable_if< has_value_type >::type > -{ - // go down the value_type - typedef typename extract_value_type< typename S::value_type >::type type; -}; + : mpl::if_< is_same< S, typename S::value_type > , + mpl::identity< S > , // cut the recursion if S and S::value_type are the same + extract_value_type< typename S::value_type > >::type +{}; } } } }