lmi-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lmi-commits] [4852] Remove the anomaly demonstrated 20100423T1401Z


From: Greg Chicares
Subject: [lmi-commits] [4852] Remove the anomaly demonstrated 20100423T1401Z
Date: Fri, 23 Apr 2010 14:40:36 +0000

Revision: 4852
          http://svn.sv.gnu.org/viewvc/?view=rev&root=lmi&revision=4852
Author:   chicares
Date:     2010-04-23 14:40:28 +0000 (Fri, 23 Apr 2010)
Log Message:
-----------
Remove the anomaly demonstrated 20100423T1401Z

Modified Paths:
--------------
    lmi/trunk/round_to.hpp
    lmi/trunk/round_to_test.cpp

Modified: lmi/trunk/round_to.hpp
===================================================================
--- lmi/trunk/round_to.hpp      2010-04-23 14:01:28 UTC (rev 4851)
+++ lmi/trunk/round_to.hpp      2010-04-23 14:40:28 UTC (rev 4852)
@@ -411,6 +411,12 @@
         }
     return i_part;
 }
+
+template<typename RealType>
+RealType erroneous_rounding_function(RealType)
+{
+    throw std::logic_error("Erroneous rounding function.");
+}
 } // namespace detail
 
 // See HTML documentation.
@@ -450,15 +456,19 @@
     rounding_function_t rounding_function;
 };
 
-// This default ctor only renders the class DefaultConstructible.
-// The object it creates is intentionally not usable.
+/// This default ctor only renders the class DefaultConstructible.
+/// The object it creates throws on use.
+///
+/// The cast to 'rounding_function_t' seems to be required by the
+/// ancient borland compiler.
+
 template<typename RealType>
 round_to<RealType>::round_to()
     :decimals_(0)
     ,style_(r_indeterminate)
     ,scale_fwd_(1.0)
     ,scale_back_(1.0)
-    ,rounding_function(0)
+    
,rounding_function((rounding_function_t)detail::erroneous_rounding_function)
 {
 }
 

Modified: lmi/trunk/round_to_test.cpp
===================================================================
--- lmi/trunk/round_to_test.cpp 2010-04-23 14:01:28 UTC (rev 4851)
+++ lmi/trunk/round_to_test.cpp 2010-04-23 14:40:28 UTC (rev 4852)
@@ -603,7 +603,11 @@
 
     // Test default constructor.
     round_to<double> const round_erroneously;
-    round_erroneously(2.7);
+    BOOST_TEST_THROW
+        (round_erroneously(2.7)
+        ,std::logic_error
+        ,"Erroneous rounding function."
+        );
 
     // Test copy constructor and copy assignment operator.
     round_to<double> const round0(2, r_to_nearest);





reply via email to

[Prev in Thread] Current Thread [Next in Thread]