]> git.lyx.org Git - lyx.git/blobdiff - boost/boost/operators.hpp
Don't allow newline characters in document settings.
[lyx.git] / boost / boost / operators.hpp
index b3b1bd72a4679a817ad911eb2b86e665ca910e2d..b524cee381a327c469a9d37cd7a20d559b69be50 100644 (file)
@@ -8,6 +8,11 @@
 //  See http://www.boost.org/libs/utility/operators.htm for documentation.
 
 //  Revision History
+//  16 Dec 10 Limit warning suppression for 4284 to older versions of VC++
+//            (Matthew Bradbury, fixes #4432)
+//  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
@@ -85,7 +90,7 @@
 #   pragma set woff 1234
 #endif
 
-#if defined(BOOST_MSVC)
+#if BOOST_WORKAROUND(BOOST_MSVC, < 1600)
 #   pragma warning( disable : 4284 ) // complaint about return type of 
 #endif                               // operator-> not begin a UDT
 
@@ -124,34 +129,34 @@ namespace boost
 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 +361,7 @@ struct equivalent2 : 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);
   }
 };
 
@@ -365,7 +370,7 @@ struct equivalent1 : B
 {
   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 +378,17 @@ template <class T, class U, class B = ::boost::detail::empty_base<T> >
 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 +397,9 @@ struct partially_ordered1 : B
   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 +585,35 @@ struct ordered_euclidian_ring_operators1
     : 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 +870,8 @@ BOOST_OPERATOR_TEMPLATE(field_operators)
 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)