Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r53172 - in branches/release: boost libs/utility
From: d.frey_at_[hidden]
Date: 2009-05-22 05:00:13


Author: daniel_frey
Date: 2009-05-22 05:00:11 EDT (Fri, 22 May 2009)
New Revision: 53172
URL: http://svn.boost.org/trac/boost/changeset/53172

Log:
Merge [44151], [48025] to release. Closes #3064.
Text files modified:
   branches/release/boost/operators.hpp | 69 +++++-
   branches/release/libs/utility/operators.htm | 38 ++-
   branches/release/libs/utility/operators_test.cpp | 408 ++++++++++++++++++++++-----------------
   3 files changed, 300 insertions(+), 215 deletions(-)

Modified: branches/release/boost/operators.hpp
==============================================================================
--- branches/release/boost/operators.hpp (original)
+++ branches/release/boost/operators.hpp 2009-05-22 05:00:11 EDT (Fri, 22 May 2009)
@@ -8,6 +8,9 @@
 // See http://www.boost.org/libs/utility/operators.htm for documentation.
 
 // Revision History
+// 07 Aug 08 Added "euclidean" spelling. (Daniel Frey)
+// 03 Apr 08 Make sure "convertible to bool" is sufficient
+// for T::operator<, etc. (Daniel Frey)
 // 24 May 07 Changed empty_base to depend on T, see
 // http://svn.boost.org/trac/boost/ticket/979
 // 21 Oct 02 Modified implementation of operators to allow compilers with a
@@ -124,34 +127,34 @@
 template <class T, class U, class B = ::boost::detail::empty_base<T> >
 struct less_than_comparable2 : B
 {
- friend bool operator<=(const T& x, const U& y) { return !(x > y); }
- friend bool operator>=(const T& x, const U& y) { return !(x < y); }
+ friend bool operator<=(const T& x, const U& y) { return !static_cast<bool>(x > y); }
+ friend bool operator>=(const T& x, const U& y) { return !static_cast<bool>(x < y); }
      friend bool operator>(const U& x, const T& y) { return y < x; }
      friend bool operator<(const U& x, const T& y) { return y > x; }
- friend bool operator<=(const U& x, const T& y) { return !(y < x); }
- friend bool operator>=(const U& x, const T& y) { return !(y > x); }
+ friend bool operator<=(const U& x, const T& y) { return !static_cast<bool>(y < x); }
+ friend bool operator>=(const U& x, const T& y) { return !static_cast<bool>(y > x); }
 };
 
 template <class T, class B = ::boost::detail::empty_base<T> >
 struct less_than_comparable1 : B
 {
      friend bool operator>(const T& x, const T& y) { return y < x; }
- friend bool operator<=(const T& x, const T& y) { return !(y < x); }
- friend bool operator>=(const T& x, const T& y) { return !(x < y); }
+ friend bool operator<=(const T& x, const T& y) { return !static_cast<bool>(y < x); }
+ friend bool operator>=(const T& x, const T& y) { return !static_cast<bool>(x < y); }
 };
 
 template <class T, class U, class B = ::boost::detail::empty_base<T> >
 struct equality_comparable2 : B
 {
      friend bool operator==(const U& y, const T& x) { return x == y; }
- friend bool operator!=(const U& y, const T& x) { return !(x == y); }
- friend bool operator!=(const T& y, const U& x) { return !(y == x); }
+ friend bool operator!=(const U& y, const T& x) { return !static_cast<bool>(x == y); }
+ friend bool operator!=(const T& y, const U& x) { return !static_cast<bool>(y == x); }
 };
 
 template <class T, class B = ::boost::detail::empty_base<T> >
 struct equality_comparable1 : B
 {
- friend bool operator!=(const T& x, const T& y) { return !(x == y); }
+ friend bool operator!=(const T& x, const T& y) { return !static_cast<bool>(x == y); }
 };
 
 // A macro which produces "name_2left" from "name".
@@ -356,7 +359,7 @@
 {
   friend bool operator==(const T& x, const U& y)
   {
- return !(x < y) && !(x > y);
+ return !static_cast<bool>(x < y) && !static_cast<bool>(x > y);
   }
 };
 
@@ -365,7 +368,7 @@
 {
   friend bool operator==(const T&x, const T&y)
   {
- return !(x < y) && !(y < x);
+ return !static_cast<bool>(x < y) && !static_cast<bool>(y < x);
   }
 };
 
@@ -373,17 +376,17 @@
 struct partially_ordered2 : B
 {
   friend bool operator<=(const T& x, const U& y)
- { return (x < y) || (x == y); }
+ { return static_cast<bool>(x < y) || static_cast<bool>(x == y); }
   friend bool operator>=(const T& x, const U& y)
- { return (x > y) || (x == y); }
+ { return static_cast<bool>(x > y) || static_cast<bool>(x == y); }
   friend bool operator>(const U& x, const T& y)
     { return y < x; }
   friend bool operator<(const U& x, const T& y)
     { return y > x; }
   friend bool operator<=(const U& x, const T& y)
- { return (y > x) || (y == x); }
+ { return static_cast<bool>(y > x) || static_cast<bool>(y == x); }
   friend bool operator>=(const U& x, const T& y)
- { return (y < x) || (y == x); }
+ { return static_cast<bool>(y < x) || static_cast<bool>(y == x); }
 };
 
 template <class T, class B = ::boost::detail::empty_base<T> >
@@ -392,9 +395,9 @@
   friend bool operator>(const T& x, const T& y)
     { return y < x; }
   friend bool operator<=(const T& x, const T& y)
- { return (x < y) || (x == y); }
+ { return static_cast<bool>(x < y) || static_cast<bool>(x == y); }
   friend bool operator>=(const T& x, const T& y)
- { return (y < x) || (x == y); }
+ { return static_cast<bool>(y < x) || static_cast<bool>(x == y); }
 };
 
 // Combined operator classes (contributed by Daryle Walker) ----------------//
@@ -580,7 +583,35 @@
     : totally_ordered1<T
     , euclidian_ring_operators1<T, B
> > {};
-
+
+template <class T, class U, class B = ::boost::detail::empty_base<T> >
+struct euclidean_ring_operators2
+ : ring_operators2<T, U
+ , dividable2<T, U
+ , dividable2_left<T, U
+ , modable2<T, U
+ , modable2_left<T, U, B
+ > > > > > {};
+
+template <class T, class B = ::boost::detail::empty_base<T> >
+struct euclidean_ring_operators1
+ : ring_operators1<T
+ , dividable1<T
+ , modable1<T, B
+ > > > {};
+
+template <class T, class U, class B = ::boost::detail::empty_base<T> >
+struct ordered_euclidean_ring_operators2
+ : totally_ordered2<T, U
+ , euclidean_ring_operators2<T, U, B
+ > > {};
+
+template <class T, class B = ::boost::detail::empty_base<T> >
+struct ordered_euclidean_ring_operators1
+ : totally_ordered1<T
+ , euclidean_ring_operators1<T, B
+ > > {};
+
 template <class T, class P, class B = ::boost::detail::empty_base<T> >
 struct input_iteratable
     : equality_comparable1<T
@@ -837,6 +868,8 @@
 BOOST_OPERATOR_TEMPLATE(ordered_field_operators)
 BOOST_OPERATOR_TEMPLATE(euclidian_ring_operators)
 BOOST_OPERATOR_TEMPLATE(ordered_euclidian_ring_operators)
+BOOST_OPERATOR_TEMPLATE(euclidean_ring_operators)
+BOOST_OPERATOR_TEMPLATE(ordered_euclidean_ring_operators)
 BOOST_OPERATOR_TEMPLATE2(input_iteratable)
 BOOST_OPERATOR_TEMPLATE1(output_iteratable)
 BOOST_OPERATOR_TEMPLATE2(forward_iteratable)

Modified: branches/release/libs/utility/operators.htm
==============================================================================
--- branches/release/libs/utility/operators.htm (original)
+++ branches/release/libs/utility/operators.htm 2009-05-22 05:00:11 EDT (Fri, 22 May 2009)
@@ -1420,9 +1420,9 @@
 
       <tr>
         <td><code><a name=
- "euclidian_ring_operators1">euclidian_ring_operators&lt;T&gt;</a></code><br>
+ "euclidean_ring_operators1">euclidean_ring_operators&lt;T&gt;</a></code><br>
 
- <code>euclidian_ring_operators1&lt;T&gt;</code></td>
+ <code>euclidean_ring_operators1&lt;T&gt;</code></td>
 
         <td>
           <ul>
@@ -1439,9 +1439,9 @@
 
       <tr>
         <td><code><a name=
- "euclidian_ring_operators2">euclidian_ring_operators&lt;T,
+ "euclidean_ring_operators2">euclidean_ring_operators&lt;T,
         U&gt;</a></code><br>
- <code>euclidian_ring_operators2&lt;T, U&gt;</code></td>
+ <code>euclidean_ring_operators2&lt;T, U&gt;</code></td>
 
         <td>
           <ul>
@@ -1464,14 +1464,14 @@
 
       <tr>
         <td><code><a name=
- "ordered_euclidian_ring_operators1">ordered_euclidian_ring_operators&lt;T&gt;</a></code><br>
+ "ordered_euclidean_ring_operators1">ordered_euclidean_ring_operators&lt;T&gt;</a></code><br>
 
- <code>ordered_euclidian_ring_operators1&lt;T&gt;</code></td>
+ <code>ordered_euclidean_ring_operators1&lt;T&gt;</code></td>
 
         <td>
           <ul>
             <li><code><a href=
- "#euclidian_ring_operators1">euclidian_ring_operators&lt;T&gt;</a></code></li>
+ "#euclidean_ring_operators1">euclidean_ring_operators&lt;T&gt;</a></code></li>
 
             <li><code><a href=
             "#totally_ordered1">totally_ordered&lt;T&gt;</a></code></li>
@@ -1481,14 +1481,14 @@
 
       <tr>
         <td><code><a name=
- "ordered_euclidian_ring_operators2">ordered_euclidian_ring_operators&lt;T,
+ "ordered_euclidean_ring_operators2">ordered_euclidean_ring_operators&lt;T,
         U&gt;</a></code><br>
- <code>ordered_euclidian_ring_operators2&lt;T, U&gt;</code></td>
+ <code>ordered_euclidean_ring_operators2&lt;T, U&gt;</code></td>
 
         <td>
           <ul>
             <li><code><a href=
- "#euclidian_ring_operators2">euclidian_ring_operators&lt;T,
+ "#euclidean_ring_operators2">euclidean_ring_operators&lt;T,
             U&gt;</a></code></li>
 
             <li><code><a href="#totally_ordered2">totally_ordered&lt;T,
@@ -1498,6 +1498,15 @@
       </tr>
     </table>
 
+ <h4>Spelling: euclidean vs. euclidian</h4>
+
+ <p>Older versions of the Boost.Operators library used
+ &quot;<code>euclidian</code>&quot;, but it was pointed out that
+ &quot;<code>euclidean</code>&quot; is the more common spelling.
+ To be compatible with older version, the library now supports
+ both spellings.
+ </p>
+
     <h3><a name="ex_oprs">Example</a> Templates</h3>
 
     <p>The arithmetic operator class templates <code><a href=
@@ -1576,9 +1585,8 @@
 
     <p>The <cite>operators_test.cpp</cite>
     program demonstrates the use of the arithmetic operator templates, and
- can also be used to verify correct operation. Check the <a href=
- "../../status/compiler_status.html">compiler status report</a> for the
- test results with selected platforms.</p>
+ can also be used to verify correct operation. Check the compiler status
+ report for the test results with selected platforms.</p>
 
     <h2><a name="deref">Dereference</a> Operators and Iterator Helpers</h2>
 
@@ -2119,10 +2127,10 @@
     backward-compatible.</p>
     <hr>
 
- <p>Revised: 29 Oct 2004</p>
+ <p>Revised: 7 Aug 2008</p>
 
     <p>Copyright &copy; Beman Dawes, David Abrahams, 1999-2001.</p>
- <p>Copyright &copy; Daniel Frey, 2002-2004.</p>
+ <p>Copyright &copy; Daniel Frey, 2002-2008.</p>
     <p>Use, modification, and distribution is subject to the Boost Software
     License, Version 1.0. (See accompanying file
     <a href="../../LICENSE_1_0.txt">LICENSE_1_0.txt</a> or copy at

Modified: branches/release/libs/utility/operators_test.cpp
==============================================================================
--- branches/release/libs/utility/operators_test.cpp (original)
+++ branches/release/libs/utility/operators_test.cpp 2009-05-22 05:00:11 EDT (Fri, 22 May 2009)
@@ -7,6 +7,7 @@
 // See http://www.boost.org/libs/utility for documentation.
 
 // Revision History
+// 03 Apr 08 Added convertible_to_bool (Daniel Frey)
 // 01 Oct 01 Added tests for "left" operators
 // and new grouped operators. (Helmut Zeisel)
 // 20 May 01 Output progress messages. Added tests for new operator
@@ -43,6 +44,23 @@
     unsigned char true_value(unsigned char x) { return x; }
     unsigned short true_value(unsigned short x) { return x; }
 
+ // verify the minimum requirements for some operators
+ class convertible_to_bool
+ {
+ private:
+ bool _value;
+
+ typedef bool convertible_to_bool::*unspecified_bool_type;
+
+ void operator!() const;
+
+ public:
+ convertible_to_bool( const bool value ) : _value( value ) {}
+
+ operator unspecified_bool_type() const
+ { return _value ? &convertible_to_bool::_value : 0; }
+ };
+
     // The use of operators<> here tended to obscure
     // interactions with certain compiler bugs
     template <class T>
@@ -54,8 +72,10 @@
         explicit Wrapped1( T v = T() ) : _value(v) {}
         T value() const { return _value; }
 
- bool operator<(const Wrapped1& x) const { return _value < x._value; }
- bool operator==(const Wrapped1& x) const { return _value == x._value; }
+ convertible_to_bool operator<(const Wrapped1& x) const
+ { return _value < x._value; }
+ convertible_to_bool operator==(const Wrapped1& x) const
+ { return _value == x._value; }
         
         Wrapped1& operator+=(const Wrapped1& x)
           { _value += x._value; return *this; }
@@ -97,8 +117,10 @@
         explicit Wrapped2( T v = T() ) : _value(v) {}
         T value() const { return _value; }
 
- bool operator<(const Wrapped2& x) const { return _value < x._value; }
- bool operator==(const Wrapped2& x) const { return _value == x._value; }
+ convertible_to_bool operator<(const Wrapped2& x) const
+ { return _value < x._value; }
+ convertible_to_bool operator==(const Wrapped2& x) const
+ { return _value == x._value; }
         
         Wrapped2& operator+=(const Wrapped2& x)
           { _value += x._value; return *this; }
@@ -123,9 +145,13 @@
         Wrapped2& operator++() { ++_value; return *this; }
         Wrapped2& operator--() { --_value; return *this; }
          
- bool operator<(U u) const { return _value < u; }
- bool operator>(U u) const { return _value > u; }
- bool operator==(U u) const { return _value == u; }
+ convertible_to_bool operator<(U u) const
+ { return _value < u; }
+ convertible_to_bool operator>(U u) const
+ { return _value > u; }
+ convertible_to_bool operator==(U u) const
+ { return _value == u; }
+
         Wrapped2& operator+=(U u) { _value += u; return *this; }
         Wrapped2& operator-=(U u) { _value -= u; return *this; }
         Wrapped2& operator*=(U u) { _value *= u; return *this; }
@@ -153,7 +179,8 @@
         explicit Wrapped3( T v = T() ) : _value(v) {}
         T value() const { return _value; }
 
- bool operator<(const Wrapped3& x) const { return _value < x._value; }
+ convertible_to_bool operator<(const Wrapped3& x) const
+ { return _value < x._value; }
         
     private:
         T _value;
@@ -174,10 +201,13 @@
         explicit Wrapped4( T v = T() ) : _value(v) {}
         T value() const { return _value; }
 
- bool operator<(const Wrapped4& x) const { return _value < x._value; }
+ convertible_to_bool operator<(const Wrapped4& x) const
+ { return _value < x._value; }
          
- bool operator<(U u) const { return _value < u; }
- bool operator>(U u) const { return _value > u; }
+ convertible_to_bool operator<(U u) const
+ { return _value < u; }
+ convertible_to_bool operator>(U u) const
+ { return _value > u; }
 
     private:
         T _value;
@@ -198,11 +228,18 @@
         Wrapped5(U u) : _value(u) {}
 
         T value() const { return _value; }
- bool operator<(const Wrapped5& x) const { return _value < x._value; }
- bool operator<(U u) const { return _value < u; }
- bool operator>(U u) const { return _value > u; }
- bool operator==(const Wrapped5& u) const { return _value == u._value; }
- bool operator==(U u) const { return _value == u; }
+
+ convertible_to_bool operator<(const Wrapped5& x) const
+ { return _value < x._value; }
+ convertible_to_bool operator<(U u) const
+ { return _value < u; }
+ convertible_to_bool operator>(U u) const
+ { return _value > u; }
+ convertible_to_bool operator==(const Wrapped5& u) const
+ { return _value == u._value; }
+ convertible_to_bool operator==(U u) const
+ { return _value == u; }
+
         Wrapped5& operator/=(const Wrapped5& u) { _value /= u._value; return *this;}
         Wrapped5& operator/=(U u) { _value /= u; return *this;}
         Wrapped5& operator*=(const Wrapped5& u) { _value *= u._value; return *this;}
@@ -221,8 +258,8 @@
     // U must be convertible to T
     template <class T, class U>
     class Wrapped6
- : boost::ordered_euclidian_ring_operators2<Wrapped6<T, U>, U>
- , boost::ordered_euclidian_ring_operators1<Wrapped6<T, U> >
+ : boost::ordered_euclidean_ring_operators2<Wrapped6<T, U>, U>
+ , boost::ordered_euclidean_ring_operators1<Wrapped6<T, U> >
     {
     public:
         explicit Wrapped6( T v = T() ) : _value(v) {}
@@ -231,11 +268,18 @@
         Wrapped6(U u) : _value(u) {}
 
         T value() const { return _value; }
- bool operator<(const Wrapped6& x) const { return _value < x._value; }
- bool operator<(U u) const { return _value < u; }
- bool operator>(U u) const { return _value > u; }
- bool operator==(const Wrapped6& u) const { return _value == u._value; }
- bool operator==(U u) const { return _value == u; }
+
+ convertible_to_bool operator<(const Wrapped6& x) const
+ { return _value < x._value; }
+ convertible_to_bool operator<(U u) const
+ { return _value < u; }
+ convertible_to_bool operator>(U u) const
+ { return _value > u; }
+ convertible_to_bool operator==(const Wrapped6& u) const
+ { return _value == u._value; }
+ convertible_to_bool operator==(U u) const
+ { return _value == u; }
+
         Wrapped6& operator%=(const Wrapped6& u) { _value %= u._value; return *this;}
         Wrapped6& operator%=(U u) { _value %= u; return *this;}
         Wrapped6& operator/=(const Wrapped6& u) { _value /= u._value; return *this;}
@@ -276,10 +320,10 @@
     template <class X1, class Y1, class X2, class Y2>
     void test_less_than_comparable_aux(X1 x1, Y1 y1, X2 x2, Y2 y2)
     {
- BOOST_CHECK( (x1 < y1) == (x2 < y2) );
- BOOST_CHECK( (x1 <= y1) == (x2 <= y2) );
- BOOST_CHECK( (x1 >= y1) == (x2 >= y2) );
- BOOST_CHECK( (x1 > y1) == (x2 > y2) );
+ BOOST_CHECK( static_cast<bool>(x1 < y1) == static_cast<bool>(x2 < y2) );
+ BOOST_CHECK( static_cast<bool>(x1 <= y1) == static_cast<bool>(x2 <= y2) );
+ BOOST_CHECK( static_cast<bool>(x1 >= y1) == static_cast<bool>(x2 >= y2) );
+ BOOST_CHECK( static_cast<bool>(x1 > y1) == static_cast<bool>(x2 > y2) );
     }
     
     template <class X1, class Y1, class X2, class Y2>
@@ -293,8 +337,8 @@
     template <class X1, class Y1, class X2, class Y2>
     void test_equality_comparable_aux(X1 x1, Y1 y1, X2 x2, Y2 y2)
     {
- BOOST_CHECK( (x1 == y1) == (x2 == y2) );
- BOOST_CHECK( (x1 != y1) == (x2 != y2) );
+ BOOST_CHECK( static_cast<bool>(x1 == y1) == static_cast<bool>(x2 == y2) );
+ BOOST_CHECK( static_cast<bool>(x1 != y1) == static_cast<bool>(x2 != y2) );
     }
     
     template <class X1, class Y1, class X2, class Y2>
@@ -614,14 +658,14 @@
 
     PRIVATE_EXPR_TEST( (i = i2), (i.value() == 2) );
 
- BOOST_CHECK( i2 == i );
- BOOST_CHECK( i1 != i2 );
- BOOST_CHECK( i1 < i2 );
- BOOST_CHECK( i1 <= i2 );
- BOOST_CHECK( i <= i2 );
- BOOST_CHECK( i2 > i1 );
- BOOST_CHECK( i2 >= i1 );
- BOOST_CHECK( i2 >= i );
+ BOOST_CHECK( static_cast<bool>(i2 == i) );
+ BOOST_CHECK( static_cast<bool>(i1 != i2) );
+ BOOST_CHECK( static_cast<bool>(i1 < i2) );
+ BOOST_CHECK( static_cast<bool>(i1 <= i2) );
+ BOOST_CHECK( static_cast<bool>(i <= i2) );
+ BOOST_CHECK( static_cast<bool>(i2 > i1) );
+ BOOST_CHECK( static_cast<bool>(i2 >= i1) );
+ BOOST_CHECK( static_cast<bool>(i2 >= i) );
 
     PRIVATE_EXPR_TEST( (i = i1 + i2), (i.value() == 3) );
     PRIVATE_EXPR_TEST( (i = i + i2), (i.value() == 5) );
@@ -653,78 +697,78 @@
 
     PRIVATE_EXPR_TEST( (j = j2), (j.value() == 2) );
     
- BOOST_CHECK( j2 == j );
- BOOST_CHECK( 2 == j );
- BOOST_CHECK( j2 == 2 );
- BOOST_CHECK( j == j2 );
- BOOST_CHECK( j1 != j2 );
- BOOST_CHECK( j1 != 2 );
- BOOST_CHECK( 1 != j2 );
- BOOST_CHECK( j1 < j2 );
- BOOST_CHECK( 1 < j2 );
- BOOST_CHECK( j1 < 2 );
- BOOST_CHECK( j1 <= j2 );
- BOOST_CHECK( 1 <= j2 );
- BOOST_CHECK( j1 <= j );
- BOOST_CHECK( j <= j2 );
- BOOST_CHECK( 2 <= j2 );
- BOOST_CHECK( j <= 2 );
- BOOST_CHECK( j2 > j1 );
- BOOST_CHECK( 2 > j1 );
- BOOST_CHECK( j2 > 1 );
- BOOST_CHECK( j2 >= j1 );
- BOOST_CHECK( 2 >= j1 );
- BOOST_CHECK( j2 >= 1 );
- BOOST_CHECK( j2 >= j );
- BOOST_CHECK( 2 >= j );
- BOOST_CHECK( j2 >= 2 );
+ BOOST_CHECK( static_cast<bool>(j2 == j) );
+ BOOST_CHECK( static_cast<bool>(2 == j) );
+ BOOST_CHECK( static_cast<bool>(j2 == 2) );
+ BOOST_CHECK( static_cast<bool>(j == j2) );
+ BOOST_CHECK( static_cast<bool>(j1 != j2) );
+ BOOST_CHECK( static_cast<bool>(j1 != 2) );
+ BOOST_CHECK( static_cast<bool>(1 != j2) );
+ BOOST_CHECK( static_cast<bool>(j1 < j2) );
+ BOOST_CHECK( static_cast<bool>(1 < j2) );
+ BOOST_CHECK( static_cast<bool>(j1 < 2) );
+ BOOST_CHECK( static_cast<bool>(j1 <= j2) );
+ BOOST_CHECK( static_cast<bool>(1 <= j2) );
+ BOOST_CHECK( static_cast<bool>(j1 <= j) );
+ BOOST_CHECK( static_cast<bool>(j <= j2) );
+ BOOST_CHECK( static_cast<bool>(2 <= j2) );
+ BOOST_CHECK( static_cast<bool>(j <= 2) );
+ BOOST_CHECK( static_cast<bool>(j2 > j1) );
+ BOOST_CHECK( static_cast<bool>(2 > j1) );
+ BOOST_CHECK( static_cast<bool>(j2 > 1) );
+ BOOST_CHECK( static_cast<bool>(j2 >= j1) );
+ BOOST_CHECK( static_cast<bool>(2 >= j1) );
+ BOOST_CHECK( static_cast<bool>(j2 >= 1) );
+ BOOST_CHECK( static_cast<bool>(j2 >= j) );
+ BOOST_CHECK( static_cast<bool>(2 >= j) );
+ BOOST_CHECK( static_cast<bool>(j2 >= 2) );
 
- BOOST_CHECK( (j1 + 2) == 3 );
- BOOST_CHECK( (1 + j2) == 3 );
+ BOOST_CHECK( static_cast<bool>((j1 + 2) == 3) );
+ BOOST_CHECK( static_cast<bool>((1 + j2) == 3) );
     PRIVATE_EXPR_TEST( (j = j1 + j2), (j.value() == 3) );
     
- BOOST_CHECK( (j + 2) == 5 );
- BOOST_CHECK( (3 + j2) == 5 );
+ BOOST_CHECK( static_cast<bool>((j + 2) == 5) );
+ BOOST_CHECK( static_cast<bool>((3 + j2) == 5) );
     PRIVATE_EXPR_TEST( (j = j + j2), (j.value() == 5) );
     
- BOOST_CHECK( (j - 1) == 4 );
+ BOOST_CHECK( static_cast<bool>((j - 1) == 4) );
     PRIVATE_EXPR_TEST( (j = j - j1), (j.value() == 4) );
     
- BOOST_CHECK( (j * 2) == 8 );
- BOOST_CHECK( (4 * j2) == 8 );
+ BOOST_CHECK( static_cast<bool>((j * 2) == 8) );
+ BOOST_CHECK( static_cast<bool>((4 * j2) == 8) );
     PRIVATE_EXPR_TEST( (j = j * j2), (j.value() == 8) );
     
- BOOST_CHECK( (j / 2) == 4 );
+ BOOST_CHECK( static_cast<bool>((j / 2) == 4) );
     PRIVATE_EXPR_TEST( (j = j / j2), (j.value() == 4) );
     
- BOOST_CHECK( (j % 3) == 1 );
+ BOOST_CHECK( static_cast<bool>((j % 3) == 1) );
     PRIVATE_EXPR_TEST( (j = j % ( j - j1 )), (j.value() == 1) );
     
     PRIVATE_EXPR_TEST( (j = j2 + j2), (j.value() == 4) );
     
- BOOST_CHECK( (1 | j2 | j) == 7 );
- BOOST_CHECK( (j1 | 2 | j) == 7 );
- BOOST_CHECK( (j1 | j2 | 4) == 7 );
+ BOOST_CHECK( static_cast<bool>((1 | j2 | j) == 7) );
+ BOOST_CHECK( static_cast<bool>((j1 | 2 | j) == 7) );
+ BOOST_CHECK( static_cast<bool>((j1 | j2 | 4) == 7) );
     PRIVATE_EXPR_TEST( (j = j1 | j2 | j), (j.value() == 7) );
     
- BOOST_CHECK( (7 & j2) == 2 );
- BOOST_CHECK( (j & 2) == 2 );
+ BOOST_CHECK( static_cast<bool>((7 & j2) == 2) );
+ BOOST_CHECK( static_cast<bool>((j & 2) == 2) );
     PRIVATE_EXPR_TEST( (j = j & j2), (j.value() == 2) );
     
     PRIVATE_EXPR_TEST( (j = j | j1), (j.value() == 3) );
     
- BOOST_CHECK( (3 ^ j1) == 2 );
- BOOST_CHECK( (j ^ 1) == 2 );
+ BOOST_CHECK( static_cast<bool>((3 ^ j1) == 2) );
+ BOOST_CHECK( static_cast<bool>((j ^ 1) == 2) );
     PRIVATE_EXPR_TEST( (j = j ^ j1), (j.value() == 2) );
     
     PRIVATE_EXPR_TEST( (j = ( j + j1 ) * ( j2 | j1 )), (j.value() == 9) );
 
- BOOST_CHECK( (j1 << 2) == 4 );
- BOOST_CHECK( (j2 << 1) == 4 );
+ BOOST_CHECK( static_cast<bool>((j1 << 2) == 4) );
+ BOOST_CHECK( static_cast<bool>((j2 << 1) == 4) );
     PRIVATE_EXPR_TEST( (j = j1 << j2), (j.value() == 4) );
 
- BOOST_CHECK( (j >> 2) == 1 );
- BOOST_CHECK( (j2 >> 1) == 1 );
+ BOOST_CHECK( static_cast<bool>((j >> 2) == 1) );
+ BOOST_CHECK( static_cast<bool>((j2 >> 1) == 1) );
     PRIVATE_EXPR_TEST( (j = j2 >> j1), (j.value() == 1) );
     
     cout << "Performed tests on MyLong objects.\n";
@@ -741,14 +785,14 @@
 
     PRIVATE_EXPR_TEST( (k = k2), (k.value() == 2) );
 
- BOOST_CHECK( k2 == k );
- BOOST_CHECK( k1 != k2 );
- BOOST_CHECK( k1 < k2 );
- BOOST_CHECK( k1 <= k2 );
- BOOST_CHECK( k <= k2 );
- BOOST_CHECK( k2 > k1 );
- BOOST_CHECK( k2 >= k1 );
- BOOST_CHECK( k2 >= k );
+ BOOST_CHECK( static_cast<bool>(k2 == k) );
+ BOOST_CHECK( static_cast<bool>(k1 != k2) );
+ BOOST_CHECK( static_cast<bool>(k1 < k2) );
+ BOOST_CHECK( static_cast<bool>(k1 <= k2) );
+ BOOST_CHECK( static_cast<bool>(k <= k2) );
+ BOOST_CHECK( static_cast<bool>(k2 > k1) );
+ BOOST_CHECK( static_cast<bool>(k2 >= k1) );
+ BOOST_CHECK( static_cast<bool>(k2 >= k) );
     
     cout << "Performed tests on MyChar objects.\n";
 
@@ -764,31 +808,31 @@
 
     PRIVATE_EXPR_TEST( (l = l2), (l.value() == 2) );
     
- BOOST_CHECK( l2 == l );
- BOOST_CHECK( 2 == l );
- BOOST_CHECK( l2 == 2 );
- BOOST_CHECK( l == l2 );
- BOOST_CHECK( l1 != l2 );
- BOOST_CHECK( l1 != 2 );
- BOOST_CHECK( 1 != l2 );
- BOOST_CHECK( l1 < l2 );
- BOOST_CHECK( 1 < l2 );
- BOOST_CHECK( l1 < 2 );
- BOOST_CHECK( l1 <= l2 );
- BOOST_CHECK( 1 <= l2 );
- BOOST_CHECK( l1 <= l );
- BOOST_CHECK( l <= l2 );
- BOOST_CHECK( 2 <= l2 );
- BOOST_CHECK( l <= 2 );
- BOOST_CHECK( l2 > l1 );
- BOOST_CHECK( 2 > l1 );
- BOOST_CHECK( l2 > 1 );
- BOOST_CHECK( l2 >= l1 );
- BOOST_CHECK( 2 >= l1 );
- BOOST_CHECK( l2 >= 1 );
- BOOST_CHECK( l2 >= l );
- BOOST_CHECK( 2 >= l );
- BOOST_CHECK( l2 >= 2 );
+ BOOST_CHECK( static_cast<bool>(l2 == l) );
+ BOOST_CHECK( static_cast<bool>(2 == l) );
+ BOOST_CHECK( static_cast<bool>(l2 == 2) );
+ BOOST_CHECK( static_cast<bool>(l == l2) );
+ BOOST_CHECK( static_cast<bool>(l1 != l2) );
+ BOOST_CHECK( static_cast<bool>(l1 != 2) );
+ BOOST_CHECK( static_cast<bool>(1 != l2) );
+ BOOST_CHECK( static_cast<bool>(l1 < l2) );
+ BOOST_CHECK( static_cast<bool>(1 < l2) );
+ BOOST_CHECK( static_cast<bool>(l1 < 2) );
+ BOOST_CHECK( static_cast<bool>(l1 <= l2) );
+ BOOST_CHECK( static_cast<bool>(1 <= l2) );
+ BOOST_CHECK( static_cast<bool>(l1 <= l) );
+ BOOST_CHECK( static_cast<bool>(l <= l2) );
+ BOOST_CHECK( static_cast<bool>(2 <= l2) );
+ BOOST_CHECK( static_cast<bool>(l <= 2) );
+ BOOST_CHECK( static_cast<bool>(l2 > l1) );
+ BOOST_CHECK( static_cast<bool>(2 > l1) );
+ BOOST_CHECK( static_cast<bool>(l2 > 1) );
+ BOOST_CHECK( static_cast<bool>(l2 >= l1) );
+ BOOST_CHECK( static_cast<bool>(2 >= l1) );
+ BOOST_CHECK( static_cast<bool>(l2 >= 1) );
+ BOOST_CHECK( static_cast<bool>(l2 >= l) );
+ BOOST_CHECK( static_cast<bool>(2 >= l) );
+ BOOST_CHECK( static_cast<bool>(l2 >= 2) );
     
     cout << "Performed tests on MyShort objects.\n";
     
@@ -807,37 +851,37 @@
 
     PRIVATE_EXPR_TEST( (di = di2), (di.value() == 2) );
     
- BOOST_CHECK( di2 == di );
- BOOST_CHECK( 2 == di );
- BOOST_CHECK( di == 2 );
- BOOST_CHECK( di1 < di2 );
- BOOST_CHECK( 1 < di2 );
- BOOST_CHECK( di1 <= di2 );
- BOOST_CHECK( 1 <= di2 );
- BOOST_CHECK( di2 > di1 );
- BOOST_CHECK( di2 > 1 );
- BOOST_CHECK( di2 >= di1 );
- BOOST_CHECK( di2 >= 1 );
- BOOST_CHECK( di1 / di2 == half );
- BOOST_CHECK( di1 / 2 == half );
- BOOST_CHECK( 1 / di2 == half );
- PRIVATE_EXPR_TEST( (tmp=di1), ((tmp/=2) == half) );
- PRIVATE_EXPR_TEST( (tmp=di1), ((tmp/=di2) == half) );
- BOOST_CHECK( di1 * di2 == di2 );
- BOOST_CHECK( di1 * 2 == di2 );
- BOOST_CHECK( 1 * di2 == di2 );
- PRIVATE_EXPR_TEST( (tmp=di1), ((tmp*=2) == di2) );
- PRIVATE_EXPR_TEST( (tmp=di1), ((tmp*=di2) == di2) );
- BOOST_CHECK( di2 - di1 == di1 );
- BOOST_CHECK( di2 - 1 == di1 );
- BOOST_CHECK( 2 - di1 == di1 );
- PRIVATE_EXPR_TEST( (tmp=di2), ((tmp-=1) == di1) );
- PRIVATE_EXPR_TEST( (tmp=di2), ((tmp-=di1) == di1) );
- BOOST_CHECK( di1 + di1 == di2 );
- BOOST_CHECK( di1 + 1 == di2 );
- BOOST_CHECK( 1 + di1 == di2 );
- PRIVATE_EXPR_TEST( (tmp=di1), ((tmp+=1) == di2) );
- PRIVATE_EXPR_TEST( (tmp=di1), ((tmp+=di1) == di2) );
+ BOOST_CHECK( static_cast<bool>(di2 == di) );
+ BOOST_CHECK( static_cast<bool>(2 == di) );
+ BOOST_CHECK( static_cast<bool>(di == 2) );
+ BOOST_CHECK( static_cast<bool>(di1 < di2) );
+ BOOST_CHECK( static_cast<bool>(1 < di2) );
+ BOOST_CHECK( static_cast<bool>(di1 <= di2) );
+ BOOST_CHECK( static_cast<bool>(1 <= di2) );
+ BOOST_CHECK( static_cast<bool>(di2 > di1) );
+ BOOST_CHECK( static_cast<bool>(di2 > 1) );
+ BOOST_CHECK( static_cast<bool>(di2 >= di1) );
+ BOOST_CHECK( static_cast<bool>(di2 >= 1) );
+ BOOST_CHECK( static_cast<bool>(di1 / di2 == half) );
+ BOOST_CHECK( static_cast<bool>(di1 / 2 == half) );
+ BOOST_CHECK( static_cast<bool>(1 / di2 == half) );
+ PRIVATE_EXPR_TEST( (tmp=di1), static_cast<bool>((tmp/=2) == half) );
+ PRIVATE_EXPR_TEST( (tmp=di1), static_cast<bool>((tmp/=di2) == half) );
+ BOOST_CHECK( static_cast<bool>(di1 * di2 == di2) );
+ BOOST_CHECK( static_cast<bool>(di1 * 2 == di2) );
+ BOOST_CHECK( static_cast<bool>(1 * di2 == di2) );
+ PRIVATE_EXPR_TEST( (tmp=di1), static_cast<bool>((tmp*=2) == di2) );
+ PRIVATE_EXPR_TEST( (tmp=di1), static_cast<bool>((tmp*=di2) == di2) );
+ BOOST_CHECK( static_cast<bool>(di2 - di1 == di1) );
+ BOOST_CHECK( static_cast<bool>(di2 - 1 == di1) );
+ BOOST_CHECK( static_cast<bool>(2 - di1 == di1) );
+ PRIVATE_EXPR_TEST( (tmp=di2), static_cast<bool>((tmp-=1) == di1) );
+ PRIVATE_EXPR_TEST( (tmp=di2), static_cast<bool>((tmp-=di1) == di1) );
+ BOOST_CHECK( static_cast<bool>(di1 + di1 == di2) );
+ BOOST_CHECK( static_cast<bool>(di1 + 1 == di2) );
+ BOOST_CHECK( static_cast<bool>(1 + di1 == di2) );
+ PRIVATE_EXPR_TEST( (tmp=di1), static_cast<bool>((tmp+=1) == di2) );
+ PRIVATE_EXPR_TEST( (tmp=di1), static_cast<bool>((tmp+=di1) == di2) );
 
     cout << "Performed tests on MyDoubleInt objects.\n";
 
@@ -854,42 +898,42 @@
 
     PRIVATE_EXPR_TEST( (li = li2), (li.value() == 2) );
     
- BOOST_CHECK( li2 == li );
- BOOST_CHECK( 2 == li );
- BOOST_CHECK( li == 2 );
- BOOST_CHECK( li1 < li2 );
- BOOST_CHECK( 1 < li2 );
- BOOST_CHECK( li1 <= li2 );
- BOOST_CHECK( 1 <= li2 );
- BOOST_CHECK( li2 > li1 );
- BOOST_CHECK( li2 > 1 );
- BOOST_CHECK( li2 >= li1 );
- BOOST_CHECK( li2 >= 1 );
- BOOST_CHECK( li1 % li2 == li1 );
- BOOST_CHECK( li1 % 2 == li1 );
- BOOST_CHECK( 1 % li2 == li1 );
- PRIVATE_EXPR_TEST( (tmp2=li1), ((tmp2%=2) == li1) );
- PRIVATE_EXPR_TEST( (tmp2=li1), ((tmp2%=li2) == li1) );
- BOOST_CHECK( li1 / li2 == 0 );
- BOOST_CHECK( li1 / 2 == 0 );
- BOOST_CHECK( 1 / li2 == 0 );
- PRIVATE_EXPR_TEST( (tmp2=li1), ((tmp2/=2) == 0) );
- PRIVATE_EXPR_TEST( (tmp2=li1), ((tmp2/=li2) == 0) );
- BOOST_CHECK( li1 * li2 == li2 );
- BOOST_CHECK( li1 * 2 == li2 );
- BOOST_CHECK( 1 * li2 == li2 );
- PRIVATE_EXPR_TEST( (tmp2=li1), ((tmp2*=2) == li2) );
- PRIVATE_EXPR_TEST( (tmp2=li1), ((tmp2*=li2) == li2) );
- BOOST_CHECK( li2 - li1 == li1 );
- BOOST_CHECK( li2 - 1 == li1 );
- BOOST_CHECK( 2 - li1 == li1 );
- PRIVATE_EXPR_TEST( (tmp2=li2), ((tmp2-=1) == li1) );
- PRIVATE_EXPR_TEST( (tmp2=li2), ((tmp2-=li1) == li1) );
- BOOST_CHECK( li1 + li1 == li2 );
- BOOST_CHECK( li1 + 1 == li2 );
- BOOST_CHECK( 1 + li1 == li2 );
- PRIVATE_EXPR_TEST( (tmp2=li1), ((tmp2+=1) == li2) );
- PRIVATE_EXPR_TEST( (tmp2=li1), ((tmp2+=li1) == li2) );
+ BOOST_CHECK( static_cast<bool>(li2 == li) );
+ BOOST_CHECK( static_cast<bool>(2 == li) );
+ BOOST_CHECK( static_cast<bool>(li == 2) );
+ BOOST_CHECK( static_cast<bool>(li1 < li2) );
+ BOOST_CHECK( static_cast<bool>(1 < li2) );
+ BOOST_CHECK( static_cast<bool>(li1 <= li2) );
+ BOOST_CHECK( static_cast<bool>(1 <= li2) );
+ BOOST_CHECK( static_cast<bool>(li2 > li1) );
+ BOOST_CHECK( static_cast<bool>(li2 > 1) );
+ BOOST_CHECK( static_cast<bool>(li2 >= li1) );
+ BOOST_CHECK( static_cast<bool>(li2 >= 1) );
+ BOOST_CHECK( static_cast<bool>(li1 % li2 == li1) );
+ BOOST_CHECK( static_cast<bool>(li1 % 2 == li1) );
+ BOOST_CHECK( static_cast<bool>(1 % li2 == li1) );
+ PRIVATE_EXPR_TEST( (tmp2=li1), static_cast<bool>((tmp2%=2) == li1) );
+ PRIVATE_EXPR_TEST( (tmp2=li1), static_cast<bool>((tmp2%=li2) == li1) );
+ BOOST_CHECK( static_cast<bool>(li1 / li2 == 0) );
+ BOOST_CHECK( static_cast<bool>(li1 / 2 == 0) );
+ BOOST_CHECK( static_cast<bool>(1 / li2 == 0) );
+ PRIVATE_EXPR_TEST( (tmp2=li1), static_cast<bool>((tmp2/=2) == 0) );
+ PRIVATE_EXPR_TEST( (tmp2=li1), static_cast<bool>((tmp2/=li2) == 0) );
+ BOOST_CHECK( static_cast<bool>(li1 * li2 == li2) );
+ BOOST_CHECK( static_cast<bool>(li1 * 2 == li2) );
+ BOOST_CHECK( static_cast<bool>(1 * li2 == li2) );
+ PRIVATE_EXPR_TEST( (tmp2=li1), static_cast<bool>((tmp2*=2) == li2) );
+ PRIVATE_EXPR_TEST( (tmp2=li1), static_cast<bool>((tmp2*=li2) == li2) );
+ BOOST_CHECK( static_cast<bool>(li2 - li1 == li1) );
+ BOOST_CHECK( static_cast<bool>(li2 - 1 == li1) );
+ BOOST_CHECK( static_cast<bool>(2 - li1 == li1) );
+ PRIVATE_EXPR_TEST( (tmp2=li2), static_cast<bool>((tmp2-=1) == li1) );
+ PRIVATE_EXPR_TEST( (tmp2=li2), static_cast<bool>((tmp2-=li1) == li1) );
+ BOOST_CHECK( static_cast<bool>(li1 + li1 == li2) );
+ BOOST_CHECK( static_cast<bool>(li1 + 1 == li2) );
+ BOOST_CHECK( static_cast<bool>(1 + li1 == li2) );
+ PRIVATE_EXPR_TEST( (tmp2=li1), static_cast<bool>((tmp2+=1) == li2) );
+ PRIVATE_EXPR_TEST( (tmp2=li1), static_cast<bool>((tmp2+=li1) == li2) );
 
     cout << "Performed tests on MyLongInt objects.\n";
 


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