/
usr
/
include
/
boost
/
geometry
/
util
/
/usr/include/boost/geometry/util
mkdir
upload
Name
Size
Mode
Actions
add_const_if_c.hpp
1677
0644
edit
dl
rm
bare_type.hpp
1330
0644
edit
dl
rm
calculation_type.hpp
4873
0644
edit
dl
rm
closure_as_bool.hpp
1080
0644
edit
dl
rm
combine_if.hpp
2927
0644
edit
dl
rm
compress_variant.hpp
3098
0644
edit
dl
rm
condition.hpp
1346
0644
edit
dl
rm
coordinate_cast.hpp
1530
0644
edit
dl
rm
for_each_coordinate.hpp
2627
0644
edit
dl
rm
has_infinite_coordinate.hpp
1376
0644
edit
dl
rm
has_nan_coordinate.hpp
2375
0644
edit
dl
rm
has_non_finite_coordinate.hpp
1405
0644
edit
dl
rm
is_inverse_spheroidal_coordinates.hpp
1553
0644
edit
dl
rm
math.hpp
21972
0644
edit
dl
rm
normalize_spheroidal_box_coordinates.hpp
7317
0644
edit
dl
rm
normalize_spheroidal_coordinates.hpp
14416
0644
edit
dl
rm
order_as_direction.hpp
1211
0644
edit
dl
rm
parameter_type_of.hpp
2156
0644
edit
dl
rm
promote_floating_point.hpp
1356
0644
edit
dl
rm
promote_integral.hpp
9775
0644
edit
dl
rm
range.hpp
12445
0644
edit
dl
rm
rational.hpp
4580
0644
edit
dl
rm
select_calculation_type.hpp
2532
0644
edit
dl
rm
select_coordinate_type.hpp
2003
0644
edit
dl
rm
select_most_precise.hpp
5459
0644
edit
dl
rm
select_sequence_element.hpp
2052
0644
edit
dl
rm
series_expansion.hpp
25670
0644
edit
dl
rm
transform_variant.hpp
2735
0644
edit
dl
rm
tuples.hpp
8819
0644
edit
dl
rm
Edit:
/usr/include/boost/geometry/util/select_most_precise.hpp
(5459B)
// Boost.Geometry (aka GGL, Generic Geometry Library) // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2008-2012 Bruno Lalande, Paris, France. // Copyright (c) 2009-2012 Mateusz Loskot, London, UK. // This file was modified by Oracle on 2014. // Modifications copyright (c) 2014 Oracle and/or its affiliates. // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library // (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands. // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) #ifndef BOOST_GEOMETRY_UTIL_SELECT_MOST_PRECISE_HPP #define BOOST_GEOMETRY_UTIL_SELECT_MOST_PRECISE_HPP #include <boost/mpl/if.hpp> #include <boost/type_traits/is_floating_point.hpp> #include <boost/type_traits/is_fundamental.hpp> namespace boost { namespace geometry { #ifndef DOXYGEN_NO_DETAIL namespace detail { namespace select_most_precise { // At least one of the types is non-fundamental. Take that one. // if both are non-fundamental, the type-to-be-selected // is unknown, it should be defined by explicit specialization. template <bool Fundamental1, bool Fundamental2, typename T1, typename T2> struct select_non_fundamental { typedef T1 type; }; template <typename T1, typename T2> struct select_non_fundamental<true, false, T1, T2> { typedef T2 type; }; template <typename T1, typename T2> struct select_non_fundamental<false, true, T1, T2> { typedef T1 type; }; // Selection of largest type (e.g. int of <short int,int> // It defaults takes the first one, if second is larger, take the second one template <bool SecondLarger, typename T1, typename T2> struct select_largest { typedef T1 type; }; template <typename T1, typename T2> struct select_largest<true, T1, T2> { typedef T2 type; }; // Selection of floating point and specializations: // both FP or both !FP does never occur... template <bool FP1, bool FP2, typename T1, typename T2> struct select_floating_point { typedef char type; }; // ... so if ONE but not both of these types is floating point, take that one template <typename T1, typename T2> struct select_floating_point<true, false, T1, T2> { typedef T1 type; }; template <typename T1, typename T2> struct select_floating_point<false, true, T1, T2> { typedef T2 type; }; }} // namespace detail::select_most_precise #endif // DOXYGEN_NO_DETAIL /*! \brief Meta-function to select, of two types, the most accurate type for calculations \ingroup utility \details 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. \note This traits class is completely independant from GGL and might be a separate addition to Boost \note 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. \note If both types are non-fundamental, the result is indeterminate and currently the first one is chosen. */ template <typename T1, typename T2 = void, typename T3 = void> struct select_most_precise { typedef typename select_most_precise < typename select_most_precise<T1, T2>::type, T3 >::type type; }; template <typename T1, typename T2> struct select_most_precise<T1, T2, void> { static const bool second_larger = sizeof(T2) > sizeof(T1); static const bool one_not_fundamental = ! (boost::is_fundamental<T1>::type::value && boost::is_fundamental<T2>::type::value); static const bool both_same = boost::is_floating_point<T1>::type::value == boost::is_floating_point<T2>::type::value; typedef typename 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; }; template <typename T1> struct select_most_precise<T1, void, void> { typedef T1 type; }; }} // namespace boost::geometry #endif // BOOST_GEOMETRY_UTIL_SELECT_MOST_PRECISE_HPP
Save
cmd:
run