extract_value_type.hpp 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. /*
  2. [auto_generated]
  3. boost/numeric/odeint/algebra/detail/extract_value_type.hpp
  4. [begin_description]
  5. Extract true value type from complex types (eg. std::complex)
  6. [end_description]
  7. Copyright 2013 Karsten Ahnert
  8. Copyright 2013 Mario Mulansky
  9. Distributed under the Boost Software License, Version 1.0.
  10. (See accompanying file LICENSE_1_0.txt or
  11. copy at http://www.boost.org/LICENSE_1_0.txt)
  12. */
  13. #ifndef BOOST_NUMERIC_ODEINT_ALGEBRA_DETAIL_EXTRACT_VALUE_TYPE_HPP_INCLUDED
  14. #define BOOST_NUMERIC_ODEINT_ALGEBRA_DETAIL_EXTRACT_VALUE_TYPE_HPP_INCLUDED
  15. #include <boost/utility.hpp>
  16. #include <boost/mpl/has_xxx.hpp>
  17. BOOST_MPL_HAS_XXX_TRAIT_DEF(value_type)
  18. namespace boost {
  19. namespace numeric {
  20. namespace odeint {
  21. namespace detail {
  22. template< typename S , typename Enabler = void >
  23. struct extract_value_type {};
  24. // as long as value_types are defined we go down the value_type chain
  25. // e.g. returning S::value_type::value_type::value_type
  26. template< typename S >
  27. struct extract_value_type<S , typename boost::disable_if< has_value_type<S> >::type >
  28. {
  29. // no value_type defined, return S
  30. typedef S type;
  31. };
  32. template< typename S >
  33. struct extract_value_type< S , typename boost::enable_if< has_value_type<S> >::type >
  34. {
  35. // go down the value_type
  36. typedef typename extract_value_type< typename S::value_type >::type type;
  37. };
  38. } } } }
  39. #endif