Boost.Geometry    Boost C++ Libraries
Public Types
boost::geometry::promote_integral< T, PromoteUnsignedToUnsigned, UseCheckedInteger, IsIntegral > Class Template Reference

Meta-function to define an integral type with size than is (roughly) twice the bit size of T. More...

List of all members.

Public Types

typedef
detail::promote_integral::promote_to_larger
< T, typename
boost::mpl::begin
< integral_types >::type,
typename boost::mpl::end
< integral_types >::type,
min_bit_size_type::value >
::type 
type

Detailed Description

template<typename T, bool PromoteUnsignedToUnsigned = false, bool UseCheckedInteger = false, bool IsIntegral = boost::is_integral<T>::type::value>
class boost::geometry::promote_integral< T, PromoteUnsignedToUnsigned, UseCheckedInteger, IsIntegral >

Meta-function to define an integral type with size than is (roughly) twice the bit size of T.

This meta-function tries to promote the fundamental integral type T to a another integral type with size (roughly) twice the bit size of T.

To do this, two times the bit size of T is tested against the bit sizes of: short, int, long, boost::long_long_type, boost::int128_t and the one that first matches is chosen.

For unsigned types the bit size of T is tested against the bit sizes of the types above, if T is promoted to a signed type, or the bit sizes of unsigned short, unsigned int, unsigned long, std::size_t, boost::ulong_long_type, boost::uint128_t if T is promoted to an unsigned type.

By default an unsigned type is promoted to a signed type. This behavior is controlled by the PromoteUnsignedToUnsigned boolean template parameter, whose default value is "false". To promote an unsigned type to an unsigned type set the value of this template parameter to "true".

If the macro BOOST_GEOMETRY_NO_MULTIPRECISION_INTEGER is not defined, boost's multiprecision integer cpp_int<> is used as a last resort.

If BOOST_GEOMETRY_NO_MULTIPRECISION_INTEGER is defined and an appropriate type cannot be detected, the input type is returned as is.

Finally, if the passed type is either a floating-point type or a user-defined type it is returned as is.

Note:
boost::long_long_type and boost::ulong_long_type are considered only if the macro BOOST_HAS_LONG_LONG is defined
boost::int128_type and boost::uint128_type are considered only if the macros BOOST_HAS_INT128 and BOOST_GEOMETRY_ENABLE_INT128 are defined

Member Typedef Documentation

template<typename T , bool PromoteUnsignedToUnsigned = false, bool UseCheckedInteger = false, bool IsIntegral = boost::is_integral<T>::type::value>
typedef detail::promote_integral::promote_to_larger< T, typename boost::mpl::begin<integral_types>::type, typename boost::mpl::end<integral_types>::type, min_bit_size_type::value >::type boost::geometry::promote_integral< T, PromoteUnsignedToUnsigned, UseCheckedInteger, IsIntegral >::type

April 2, 2011

Copyright © 2007-2011 Barend Gehrels, Amsterdam, the Netherlands
Copyright © 2008-2011 Bruno Lalande, Paris, France
Copyright © 2009-2010 Mateusz Loskot, London, UK
Documentation is generated by Doxygen