Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r85548 - trunk/boost
From: dwalker07_at_[hidden]
Date: 2013-09-02 01:37:45


Author: dlwalker
Date: 2013-09-02 01:37:45 EDT (Mon, 02 Sep 2013)
New Revision: 85548
URL: http://svn.boost.org/trac/boost/changeset/85548

Log:
Removed unneeded forward declarations, added defaulted parameter to private helper function; both suggested by Mario Lang

Text files modified:
   trunk/boost/rational.hpp | 13 +++++--------
   1 files changed, 5 insertions(+), 8 deletions(-)

Modified: trunk/boost/rational.hpp
==============================================================================
--- trunk/boost/rational.hpp Sun Sep 1 17:05:14 2013 (r85547)
+++ trunk/boost/rational.hpp 2013-09-02 01:37:45 EDT (Mon, 02 Sep 2013) (r85548)
@@ -21,6 +21,8 @@
 // Nickolay Mladenov, for the implementation of operator+=
 
 // Revision History
+// 02 Sep 13 Remove unneeded forward declarations; tweak private helper
+// function (Daryle Walker)
 // 30 Aug 13 Improve exception safety of "assign"; start modernizing I/O code
 // (Daryle Walker)
 // 27 Aug 13 Add cross-version constructor template, plus some private helper
@@ -112,12 +114,6 @@
 };
 
 template <typename IntType>
-class rational;
-
-template <typename IntType>
-rational<IntType> abs(const rational<IntType>& r);
-
-template <typename IntType>
 class rational :
     less_than_comparable < rational<IntType>,
     equality_comparable < rational<IntType>,
@@ -238,7 +234,8 @@
     { return b == zero ? a : inner_gcd(b, a % b, zero); }
 
     static BOOST_CONSTEXPR
- int_type inner_abs( param_type x ) { return x < int_type(0) ? -x : +x; }
+ int_type inner_abs( param_type x, int_type const &zero = int_type(0) )
+ { return x < zero ? -x : +x; }
 
     // Representation note: Fractions are kept in normalized form at all
     // times. normalized form is defined as gcd(num,den) == 1 and den > 0.
@@ -252,7 +249,7 @@
      int_type(0), int_type const &one = int_type(1) )
     {
         return d > zero && ( n != zero || d == one ) && inner_abs( inner_gcd(n,
- d, zero) ) == one;
+ d, zero), zero ) == one;
     }
 };
 


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk