Boost C++ Libraries of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

This is the documentation for a snapshot of the develop branch, built from commit 97d4bc15ef.



 Extract true value type from complex types (eg. std::complex)

 Copyright 2013 Karsten Ahnert
 Copyright 2013 Mario Mulansky

 Distributed under the Boost Software License, Version 1.0.
 (See accompanying file LICENSE_1_0.txt or
 copy at


#include <type_traits>
#include <boost/utility.hpp>
#include <boost/mpl/identity.hpp>
#include <boost/mpl/if.hpp>
#include <boost/mpl/has_xxx.hpp>


namespace boost {
namespace numeric {
namespace odeint {
namespace detail {

template< typename S , typename Enabler = void >
struct extract_value_type
    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 std::enable_if< has_value_type<S>::value >::type >
  : mpl::if_< std::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

} } } }