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 an old version of Boost. Click here to view this page for the latest version.

Convert Numeric Types and Enums to double

Demonstrates a conversion of Numeric Types and enum types to double:

template<class T>
inline double to_double(T const& value)
    typedef typename boost::promote<T>::type promoted;
    return boost::numeric::converter<double,promoted>::convert(value);