/usr/include/boost/geometry/util
NameSizeModeActions
add_const_if_c.hpp16770644editdlrm
bare_type.hpp13300644editdlrm
calculation_type.hpp48730644editdlrm
closure_as_bool.hpp10800644editdlrm
combine_if.hpp29270644editdlrm
compress_variant.hpp30980644editdlrm
condition.hpp13460644editdlrm
coordinate_cast.hpp15300644editdlrm
for_each_coordinate.hpp26270644editdlrm
has_infinite_coordinate.hpp13760644editdlrm
has_nan_coordinate.hpp23750644editdlrm
has_non_finite_coordinate.hpp14050644editdlrm
is_inverse_spheroidal_coordinates.hpp15530644editdlrm
math.hpp219720644editdlrm
normalize_spheroidal_box_coordinates.hpp73170644editdlrm
normalize_spheroidal_coordinates.hpp144160644editdlrm
order_as_direction.hpp12110644editdlrm
parameter_type_of.hpp21560644editdlrm
promote_floating_point.hpp13560644editdlrm
promote_integral.hpp97750644editdlrm
range.hpp124450644editdlrm
rational.hpp45800644editdlrm
select_calculation_type.hpp25320644editdlrm
select_coordinate_type.hpp20030644editdlrm
select_most_precise.hpp54590644editdlrm
select_sequence_element.hpp20520644editdlrm
series_expansion.hpp256700644editdlrm
transform_variant.hpp27350644editdlrm
tuples.hpp88190644editdlrm
Edit: /usr/include/boost/geometry/util/rational.hpp (4580B)
// Boost.Geometry (aka GGL, Generic Geometry Library) // Copyright (c) 2011-2012 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2011-2012 Bruno Lalande, Paris, France. // Copyright (c) 2011-2012 Mateusz Loskot, London, UK. // 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_RATIONAL_HPP #define BOOST_GEOMETRY_UTIL_RATIONAL_HPP #include #include #include #include namespace boost{ namespace geometry { // Specialize for Boost.Geometry's coordinate cast // (from string to coordinate type) namespace detail { template struct coordinate_cast > { static inline void split_parts(std::string const& source, std::string::size_type p, T& before, T& after, bool& negate, std::string::size_type& len) { std::string before_part = source.substr(0, p); std::string const after_part = source.substr(p + 1); negate = false; if (before_part.size() > 0 && before_part[0] == '-') { negate = true; before_part.erase(0, 1); } before = atol(before_part.c_str()); after = atol(after_part.c_str()); len = after_part.length(); } static inline rational apply(std::string const& source) { T before, after; bool negate; std::string::size_type len; // Note: decimal comma is not (yet) supported, it does (and should) not // occur in a WKT, where points are comma separated. std::string::size_type p = source.find("."); if (p == std::string::npos) { p = source.find("/"); if (p == std::string::npos) { return rational(atol(source.c_str())); } split_parts(source, p, before, after, negate, len); return negate ? -rational(before, after) : rational(before, after) ; } split_parts(source, p, before, after, negate, len); T den = 1; for (std::string::size_type i = 0; i < len; i++) { den *= 10; } return negate ? -rational(before) - rational(after, den) : rational(before) + rational(after, den) ; } }; } // namespace detail // Specialize for Boost.Geometry's select_most_precise template struct select_most_precise, boost::rational > { typedef typename boost::rational < typename select_most_precise::type > type; }; template struct select_most_precise, double> { typedef typename boost::rational type; }; }} // namespace boost::geometry // Specializes boost::rational to boost::numeric::bounds namespace boost { namespace numeric { template struct bounds > { static inline rational lowest() { return rational(bounds::lowest(), 1); } static inline rational highest() { return rational(bounds::highest(), 1); } }; }} // namespace boost::numeric // Support for boost::numeric_cast to int and to double (necessary for SVG-mapper) namespace boost { namespace numeric { template < typename T, typename Traits, typename OverflowHandler, typename Float2IntRounder, typename RawConverter, typename UserRangeChecker > struct converter, Traits, OverflowHandler, Float2IntRounder, RawConverter, UserRangeChecker> { static inline int convert(rational const& arg) { return int(rational_cast(arg)); } }; template < typename T, typename Traits, typename OverflowHandler, typename Float2IntRounder, typename RawConverter, typename UserRangeChecker > struct converter, Traits, OverflowHandler, Float2IntRounder, RawConverter, UserRangeChecker> { static inline double convert(rational const& arg) { return rational_cast(arg); } }; }} #endif // BOOST_GEOMETRY_UTIL_RATIONAL_HPP