comparison DEPENDENCIES/generic/include/boost/geometry/util/rational.hpp @ 101:c530137014c0

Update Boost headers (1.58.0)
author Chris Cannam
date Mon, 07 Sep 2015 11:12:49 +0100
parents 2665513ce2d3
children
comparison
equal deleted inserted replaced
100:793467b5e61c 101:c530137014c0
19 19
20 #include <boost/geometry/util/coordinate_cast.hpp> 20 #include <boost/geometry/util/coordinate_cast.hpp>
21 #include <boost/geometry/util/select_most_precise.hpp> 21 #include <boost/geometry/util/select_most_precise.hpp>
22 22
23 23
24 namespace boost{ namespace geometry 24 namespace boost{ namespace geometry
25 { 25 {
26 26
27 27
28 // Specialize for Boost.Geometry's coordinate cast 28 // Specialize for Boost.Geometry's coordinate cast
29 // (from string to coordinate type) 29 // (from string to coordinate type)
30 namespace detail 30 namespace detail
31 { 31 {
32 32
33 template <typename T> 33 template <typename T>
68 { 68 {
69 return rational<T>(atol(source.c_str())); 69 return rational<T>(atol(source.c_str()));
70 } 70 }
71 split_parts(source, p, before, after, negate, len); 71 split_parts(source, p, before, after, negate, len);
72 72
73 return negate 73 return negate
74 ? -rational<T>(before, after) 74 ? -rational<T>(before, after)
75 : rational<T>(before, after) 75 : rational<T>(before, after)
76 ; 76 ;
77 77
78 } 78 }
83 for (std::string::size_type i = 0; i < len; i++) 83 for (std::string::size_type i = 0; i < len; i++)
84 { 84 {
85 den *= 10; 85 den *= 10;
86 } 86 }
87 87
88 return negate 88 return negate
89 ? -rational<T>(before) - rational<T>(after, den) 89 ? -rational<T>(before) - rational<T>(after, den)
90 : rational<T>(before) + rational<T>(after, den) 90 : rational<T>(before) + rational<T>(after, den)
91 ; 91 ;
92 } 92 }
93 }; 93 };
113 113
114 }} // namespace boost::geometry 114 }} // namespace boost::geometry
115 115
116 116
117 // Specializes boost::rational to boost::numeric::bounds 117 // Specializes boost::rational to boost::numeric::bounds
118 namespace boost { namespace numeric 118 namespace boost { namespace numeric
119 { 119 {
120 120
121 template<class T> 121 template<class T>
122 struct bounds<rational<T> > 122 struct bounds<rational<T> >
123 { 123 {
124 static inline rational<T> lowest() 124 static inline rational<T> lowest()
125 { 125 {
126 return rational<T>(bounds<T>::lowest(), 1); 126 return rational<T>(bounds<T>::lowest(), 1);
127 } 127 }
128 static inline rational<T> highest() 128 static inline rational<T> highest()
129 { 129 {
130 return rational<T>(bounds<T>::highest(), 1); 130 return rational<T>(bounds<T>::highest(), 1);
131 } 131 }
132 }; 132 };
133 133
134 }} // namespace boost::numeric 134 }} // namespace boost::numeric
135 135