Boost  v1.57.0
doxygen for www.boost.org
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
boost::geometry::select_most_precise< T1, T2 > Struct Template Reference

Meta-function to select, of two types, the most accurate type for calculations. More...

#include <select_most_precise.hpp>

Public Types

typedef boost::mpl::if_c
< one_not_fundamental,
typename
detail::select_most_precise::select_non_fundamental
< boost::is_fundamental< T1 >
::type::value,
boost::is_fundamental< T2 >
::type::value, T1, T2 >::type,
typename boost::mpl::if_c
< both_same, typename
detail::select_most_precise::select_largest
< second_larger, T1, T2 >
::type, typename
detail::select_most_precise::select_floating_point
< boost::is_floating_point< T1 >
::type::value,
boost::is_floating_point< T2 >
::type::value, T1, T2 >::type >
::type >::type 
type
 

Static Public Attributes

static const bool second_larger = sizeof(T2) > sizeof(T1)
 
static const bool one_not_fundamental
 
static const bool both_same
 

Detailed Description

template<typename T1, typename T2>
struct boost::geometry::select_most_precise< T1, T2 >

Meta-function to select, of two types, the most accurate type for calculations.

select_most_precise classes, compares two types on compile time. For example, if an addition must be done with a double and an integer, the result must be a double. If both types are integer, the result can be an integer.

Note
It is different from the "promote" class, already in boost. That class promotes e.g. a (one) float to a double. This class selects a type from two types. It takes the most accurate, but does not promote afterwards.
This traits class is completely independant from GGL and might be a separate addition to Boost
If the input is a non-fundamental type, it might be a calculation type such as a GMP-value or another high precision value. Therefore, if one is non-fundamental, that one is chosen.
If both types are non-fundamental, the result is indeterminate and currently the first one is chosen.

Member Typedef Documentation

template<typename T1, typename T2>
typedef boost::mpl::if_c< one_not_fundamental, typename detail::select_most_precise::select_non_fundamental < boost::is_fundamental<T1>::type::value, boost::is_fundamental<T2>::type::value, T1, T2 >::type, typename boost::mpl::if_c < both_same, typename detail::select_most_precise::select_largest < second_larger, T1, T2 >::type, typename detail::select_most_precise::select_floating_point < boost::is_floating_point<T1>::type::value, boost::is_floating_point<T2>::type::value, T1, T2 >::type >::type >::type boost::geometry::select_most_precise< T1, T2 >::type

Member Data Documentation

template<typename T1, typename T2>
const bool boost::geometry::select_most_precise< T1, T2 >::both_same
static
template<typename T1, typename T2>
const bool boost::geometry::select_most_precise< T1, T2 >::one_not_fundamental
static
template<typename T1, typename T2>
const bool boost::geometry::select_most_precise< T1, T2 >::second_larger = sizeof(T2) > sizeof(T1)
static

The documentation for this struct was generated from the following file: