Boost logo

Boost-Commit :

From: steven_at_[hidden]
Date: 2008-05-27 23:09:45


Author: steven_watanabe
Date: 2008-05-27 23:09:45 EDT (Tue, 27 May 2008)
New Revision: 45851
URL: http://svn.boost.org/trac/boost/changeset/45851

Log:
Fix direct access to val_ inside operator-=
Added:
   sandbox/units/libs/units/test/test_mixed_value_types.cpp (contents, props changed)
Text files modified:
   sandbox/units/boost/units/quantity.hpp | 4 ++--
   sandbox/units/libs/units/test/Jamfile.v2 | 1 +
   2 files changed, 3 insertions(+), 2 deletions(-)

Modified: sandbox/units/boost/units/quantity.hpp
==============================================================================
--- sandbox/units/boost/units/quantity.hpp (original)
+++ sandbox/units/boost/units/quantity.hpp 2008-05-27 23:09:45 EDT (Tue, 27 May 2008)
@@ -2,7 +2,7 @@
 // unit/quantity manipulation and conversion
 //
 // Copyright (C) 2003-2008 Matthias Christian Schabel
-// Copyright (C) 2008 Steven Watanabe
+// Copyright (C) 2007-2008 Steven Watanabe
 //
 // Distributed under the Boost Software License, Version 1.0. (See
 // accompanying file LICENSE_1_0.txt or copy at
@@ -240,7 +240,7 @@
         this_type& operator-=(const quantity<Unit2, YY>& source)
         {
             BOOST_STATIC_ASSERT((boost::is_same<typename subtract_typeof_helper<Unit, Unit2>::type, Unit>::value));
- val_ -= source.val_;
+ val_ -= source.value();
             return *this;
         }
 

Modified: sandbox/units/libs/units/test/Jamfile.v2
==============================================================================
--- sandbox/units/libs/units/test/Jamfile.v2 (original)
+++ sandbox/units/libs/units/test/Jamfile.v2 2008-05-27 23:09:45 EDT (Tue, 27 May 2008)
@@ -29,6 +29,7 @@
     [ compile test_negative_denominator.cpp : : ]
     [ compile test_dimensionless_ice1.cpp : : ]
     [ compile test_dimensionless_ice2.cpp : : ]
+ [ compile test_mixed_value_types.cpp : : ]
     [ run test_dimensionless_quantity.cpp : : : : ]
     [ run test_implicit_conversion.cpp : : : : ]
     [ run test_quantity.cpp : : : : ]

Added: sandbox/units/libs/units/test/test_mixed_value_types.cpp
==============================================================================
--- (empty file)
+++ sandbox/units/libs/units/test/test_mixed_value_types.cpp 2008-05-27 23:09:45 EDT (Tue, 27 May 2008)
@@ -0,0 +1,22 @@
+// Boost.Units - A C++ library for zero-overhead dimensional analysis and
+// unit/quantity manipulation and conversion
+//
+// Copyright (C) 2003-2008 Matthias Christian Schabel
+// Copyright (C) 2007-2008 Steven Watanabe
+//
+// Distributed under 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)
+
+#include <boost/units/quantity.hpp>
+#include <boost/units/unit.hpp>
+#include <boost/units/systems/si/length.hpp>
+
+namespace bu = boost::units;
+
+int main() {
+ bu::quantity<bu::si::length, double> q1;
+ bu::quantity<bu::si::length, int> q2;
+ q1 + q2;
+ q1 -= q2;
+}


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