Boost C++ Libraries

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

PrevUpHomeNext

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);
}

PrevUpHomeNext