3 boost/numeric/odeint/algebra/detail/extract_value_type.hpp
6 Extract true value type from complex types (eg. std::complex)
9 Copyright 2013 Karsten Ahnert
10 Copyright 2013 Mario Mulansky
12 Distributed under the Boost Software License, Version 1.0.
13 (See accompanying file LICENSE_1_0.txt or
14 copy at http://www.boost.org/LICENSE_1_0.txt)
17 #ifndef BOOST_NUMERIC_ODEINT_ALGEBRA_DETAIL_EXTRACT_VALUE_TYPE_HPP_INCLUDED
18 #define BOOST_NUMERIC_ODEINT_ALGEBRA_DETAIL_EXTRACT_VALUE_TYPE_HPP_INCLUDED
20 #include <boost/utility.hpp>
21 #include <boost/mpl/has_xxx.hpp>
23 BOOST_MPL_HAS_XXX_TRAIT_DEF(value_type)
30 template< typename S , typename Enabler = void >
31 struct extract_value_type {};
33 // as long as value_types are defined we go down the value_type chain
34 // e.g. returning S::value_type::value_type::value_type
36 template< typename S >
37 struct extract_value_type<S , typename boost::disable_if< has_value_type<S> >::type >
39 // no value_type defined, return S
43 template< typename S >
44 struct extract_value_type< S , typename boost::enable_if< has_value_type<S> >::type >
46 // go down the value_type
47 typedef typename extract_value_type< typename S::value_type >::type type;