Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r80567 - trunk/boost/polygon/detail
From: sydorchuk.andriy_at_[hidden]
Date: 2012-09-17 18:12:40


Author: asydorchuk
Date: 2012-09-17 18:12:40 EDT (Mon, 17 Sep 2012)
New Revision: 80567
URL: http://svn.boost.org/trac/boost/changeset/80567

Log:
Polygon: moving from static const int to enums.

Text files modified:
   trunk/boost/polygon/detail/voronoi_ctypes.hpp | 14 +++++++-------
   trunk/boost/polygon/detail/voronoi_robust_fpt.hpp | 20 +++++++-------------
   2 files changed, 14 insertions(+), 20 deletions(-)

Modified: trunk/boost/polygon/detail/voronoi_ctypes.hpp
==============================================================================
--- trunk/boost/polygon/detail/voronoi_ctypes.hpp (original)
+++ trunk/boost/polygon/detail/voronoi_ctypes.hpp 2012-09-17 18:12:40 EDT (Mon, 17 Sep 2012)
@@ -74,11 +74,11 @@
 class extened_exponent_fpt_traits<fpt64> {
  public:
   typedef int exp_type;
- static const int kMaxSignificantExpDif;
+ enum {
+ MAX_SIGNIFICANT_EXP_DIF = 54
+ };
 };
 
-const int extened_exponent_fpt_traits<fpt64>::kMaxSignificantExpDif = 54;
-
 // Floating point type wrapper. Allows to extend exponent boundaries to the
 // integer type range. This class does not handle division by zero, subnormal
 // numbers or NaNs.
@@ -115,11 +115,11 @@
 
   extended_exponent_fpt operator+(const extended_exponent_fpt& that) const {
     if (this->val_ == 0.0 ||
- that.exp_ > this->exp_ + _traits::kMaxSignificantExpDif) {
+ that.exp_ > this->exp_ + _traits::MAX_SIGNIFICANT_EXP_DIF) {
       return that;
     }
     if (that.val_ == 0.0 ||
- this->exp_ > that.exp_ + _traits::kMaxSignificantExpDif) {
+ this->exp_ > that.exp_ + _traits::MAX_SIGNIFICANT_EXP_DIF) {
       return *this;
     }
     if (this->exp_ >= that.exp_) {
@@ -135,11 +135,11 @@
 
   extended_exponent_fpt operator-(const extended_exponent_fpt& that) const {
     if (this->val_ == 0.0 ||
- that.exp_ > this->exp_ + _traits::kMaxSignificantExpDif) {
+ that.exp_ > this->exp_ + _traits::MAX_SIGNIFICANT_EXP_DIF) {
       return extended_exponent_fpt(-that.val_, that.exp_);
     }
     if (that.val_ == 0.0 ||
- this->exp_ > that.exp_ + _traits::kMaxSignificantExpDif) {
+ this->exp_ > that.exp_ + _traits::MAX_SIGNIFICANT_EXP_DIF) {
       return *this;
     }
     if (this->exp_ >= that.exp_) {

Modified: trunk/boost/polygon/detail/voronoi_robust_fpt.hpp
==============================================================================
--- trunk/boost/polygon/detail/voronoi_robust_fpt.hpp (original)
+++ trunk/boost/polygon/detail/voronoi_robust_fpt.hpp 2012-09-17 18:12:40 EDT (Mon, 17 Sep 2012)
@@ -440,6 +440,13 @@
   static const unsigned int EVAL3_MAX_RELATIVE_ERROR;
   static const unsigned int EVAL4_MAX_RELATIVE_ERROR;
 
+ enum MAX_RELATIVE_ERROR {
+ MAX_RELATIVE_ERROR_EVAL1 = 4,
+ MAX_RELATIVE_ERROR_EVAL2 = 7,
+ MAX_RELATIVE_ERROR_EVAL3 = 16,
+ MAX_RELATIVE_ERROR_EVAL4 = 25
+ };
+
   // Evaluates expression (re = 4 EPS):
   // A[0] * sqrt(B[0]).
   _fpt eval1(_int* A, _int* B) {
@@ -499,19 +506,6 @@
   _int tB[5];
   _converter convert;
 };
-
-template <typename _int, typename _fpt, typename _converter>
-const unsigned int robust_sqrt_expr<_int, _fpt, _converter>::
- EVAL1_MAX_RELATIVE_ERROR = 4;
-template <typename _int, typename _fpt, typename _converter>
-const unsigned int robust_sqrt_expr<_int, _fpt, _converter>::
- EVAL2_MAX_RELATIVE_ERROR = 7;
-template <typename _int, typename _fpt, typename _converter>
-const unsigned int robust_sqrt_expr<_int, _fpt, _converter>::
- EVAL3_MAX_RELATIVE_ERROR = 16;
-template <typename _int, typename _fpt, typename _converter>
-const unsigned int robust_sqrt_expr<_int, _fpt, _converter>::
- EVAL4_MAX_RELATIVE_ERROR = 25;
 } // detail
 } // polygon
 } // boost


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