]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | /* |
2 | [auto_generated] | |
3 | boost/numeric/odeint/algebra/detail/extract_value_type.hpp | |
4 | ||
5 | [begin_description] | |
6 | Extract true value type from complex types (eg. std::complex) | |
7 | [end_description] | |
8 | ||
9 | Copyright 2013 Karsten Ahnert | |
10 | Copyright 2013 Mario Mulansky | |
11 | ||
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) | |
15 | */ | |
16 | ||
17 | #ifndef BOOST_NUMERIC_ODEINT_ALGEBRA_DETAIL_EXTRACT_VALUE_TYPE_HPP_INCLUDED | |
18 | #define BOOST_NUMERIC_ODEINT_ALGEBRA_DETAIL_EXTRACT_VALUE_TYPE_HPP_INCLUDED | |
19 | ||
20 | #include <boost/utility.hpp> | |
21 | #include <boost/mpl/has_xxx.hpp> | |
22 | ||
23 | BOOST_MPL_HAS_XXX_TRAIT_DEF(value_type) | |
24 | ||
25 | namespace boost { | |
26 | namespace numeric { | |
27 | namespace odeint { | |
28 | namespace detail { | |
29 | ||
30 | template< typename S , typename Enabler = void > | |
31 | struct extract_value_type {}; | |
32 | ||
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 | |
35 | ||
36 | template< typename S > | |
37 | struct extract_value_type<S , typename boost::disable_if< has_value_type<S> >::type > | |
38 | { | |
39 | // no value_type defined, return S | |
40 | typedef S type; | |
41 | }; | |
42 | ||
43 | template< typename S > | |
44 | struct extract_value_type< S , typename boost::enable_if< has_value_type<S> >::type > | |
45 | { | |
46 | // go down the value_type | |
47 | typedef typename extract_value_type< typename S::value_type >::type type; | |
48 | }; | |
49 | ||
50 | } } } } | |
51 | ||
52 | #endif |