// Boost operators.hpp header file ----------------------------------------//
-// (C) Copyright David Abrahams, Jeremy Siek, and Daryle Walker 1999-2001.
-// Permission to copy, use, modify, sell and distribute this software is
-// granted provided this copyright notice appears in all copies. This
-// software is provided "as is" without express or implied warranty, and
-// with no claim as to its suitability for any purpose.
+// (C) Copyright David Abrahams, Jeremy Siek, Daryle Walker 1999-2001.
+// 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)
-// See http://www.boost.org for most recent version including documentation.
+// 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
+// correct named return value optimization (NRVO) to produce optimal
+// code. (Daniel Frey)
// 02 Dec 01 Bug fixed in random_access_iteratable. (Helmut Zeisel)
// 28 Sep 01 Factored out iterator operator groups. (Daryle Walker)
// 27 Aug 01 'left' form for non commutative operators added;
#include <boost/config.hpp>
#include <boost/iterator.hpp>
+#include <boost/detail/workaround.hpp>
#if defined(__sgi) && !defined(__GNUC__)
-#pragma set woff 1234
+# 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
namespace boost {
namespace detail {
-// Helmut Zeisel, empty base class optimization bug with GCC 3.0.0
-#if defined(__GNUC__) && __GNUC__==3 && __GNUC_MINOR__==0 && __GNU_PATCHLEVEL__==0
-class empty_base {
- bool dummy;
-};
-#else
-class empty_base {};
-#endif
+template <typename T> class empty_base {};
} // namespace detail
} // namespace boost
// Note that friend functions defined in a class are implicitly inline.
// See the C++ std, 11.4 [class.friend] paragraph 5
-template <class T, class U, class B = ::boost::detail::empty_base>
+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>
+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>
+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>
+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); }
-};
-
-template <class T, class U, class B = ::boost::detail::empty_base>
-struct multipliable2 : B
-{
- friend T operator*(T x, const U& y) { return x *= y; }
- friend T operator*(const U& y, T x) { return x *= y; }
-};
-
-template <class T, class B = ::boost::detail::empty_base>
-struct multipliable1 : B
-{
- friend T operator*(T x, const T& y) { return x *= y; }
-};
-
-template <class T, class U, class B = ::boost::detail::empty_base>
-struct addable2 : B
-{
- friend T operator+(T x, const U& y) { return x += y; }
- friend T operator+(const U& y, T x) { return x += y; }
-};
-
-template <class T, class B = ::boost::detail::empty_base>
-struct addable1 : B
-{
- friend T operator+(T x, const T& y) { return x += y; }
-};
-
-template <class T, class U, class B = ::boost::detail::empty_base>
-struct subtractable2 : B
-{
- friend T operator-(T x, const U& y) { return x -= y; }
-};
-
-template <class T, class U, class B = ::boost::detail::empty_base>
-struct subtractable2_left : B
-{
- friend T operator-(const U& x, const T& y)
- { T result(x); return result -= y; }
-};
-
-template <class T, class B = ::boost::detail::empty_base>
-struct subtractable1 : B
-{
- friend T operator-(T x, const T& y) { return x -= y; }
-};
-
-template <class T, class U, class B = ::boost::detail::empty_base>
-struct dividable2 : B
-{
- friend T operator/(T x, const U& y) { return x /= y; }
-};
-
-template <class T, class U, class B = ::boost::detail::empty_base>
-struct dividable2_left : B
-{
- friend T operator/(const U& x, const T& y)
- { T result(x); return result /= y; }
-};
-
-template <class T, class B = ::boost::detail::empty_base>
-struct dividable1 : B
-{
- friend T operator/(T x, const T& y) { return x /= y; }
-};
-
-template <class T, class U, class B = ::boost::detail::empty_base>
-struct modable2 : B
-{
- friend T operator%(T x, const U& y) { return x %= y; }
-};
-
-template <class T, class U, class B = ::boost::detail::empty_base>
-struct modable2_left : B
-{
- friend T operator%(const U& x, const T& y)
- { T result(x); return result %= y; }
-};
-
-template <class T, class B = ::boost::detail::empty_base>
-struct modable1 : B
-{
- friend T operator%(T x, const T& y) { return x %= y; }
-};
-
-template <class T, class U, class B = ::boost::detail::empty_base>
-struct xorable2 : B
-{
- friend T operator^(T x, const U& y) { return x ^= y; }
- friend T operator^(const U& y, T x) { return x ^= y; }
-};
-
-template <class T, class B = ::boost::detail::empty_base>
-struct xorable1 : B
-{
- friend T operator^(T x, const T& y) { return x ^= y; }
-};
-
-template <class T, class U, class B = ::boost::detail::empty_base>
-struct andable2 : B
-{
- friend T operator&(T x, const U& y) { return x &= y; }
- friend T operator&(const U& y, T x) { return x &= y; }
-};
-
-template <class T, class B = ::boost::detail::empty_base>
-struct andable1 : B
-{
- friend T operator&(T x, const T& y) { return x &= y; }
-};
-
-template <class T, class U, class B = ::boost::detail::empty_base>
-struct orable2 : B
-{
- friend T operator|(T x, const U& y) { return x |= y; }
- friend T operator|(const U& y, T x) { return x |= y; }
-};
-
-template <class T, class B = ::boost::detail::empty_base>
-struct orable1 : B
-{
- friend T operator|(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".
+#define BOOST_OPERATOR2_LEFT(name) name##2##_##left
+
+// NRVO-friendly implementation (contributed by Daniel Frey) ---------------//
+
+#if defined(BOOST_HAS_NRVO) || defined(BOOST_FORCE_SYMMETRIC_OPERATORS)
+
+// This is the optimal implementation for ISO/ANSI C++,
+// but it requires the compiler to implement the NRVO.
+// If the compiler has no NRVO, this is the best symmetric
+// implementation available.
+
+#define BOOST_BINARY_OPERATOR_COMMUTATIVE( NAME, OP ) \
+template <class T, class U, class B = ::boost::detail::empty_base<T> > \
+struct NAME##2 : B \
+{ \
+ friend T operator OP( const T& lhs, const U& rhs ) \
+ { T nrv( lhs ); nrv OP##= rhs; return nrv; } \
+ friend T operator OP( const U& lhs, const T& rhs ) \
+ { T nrv( rhs ); nrv OP##= lhs; return nrv; } \
+}; \
+ \
+template <class T, class B = ::boost::detail::empty_base<T> > \
+struct NAME##1 : B \
+{ \
+ friend T operator OP( const T& lhs, const T& rhs ) \
+ { T nrv( lhs ); nrv OP##= rhs; return nrv; } \
+};
+
+#define BOOST_BINARY_OPERATOR_NON_COMMUTATIVE( NAME, OP ) \
+template <class T, class U, class B = ::boost::detail::empty_base<T> > \
+struct NAME##2 : B \
+{ \
+ friend T operator OP( const T& lhs, const U& rhs ) \
+ { T nrv( lhs ); nrv OP##= rhs; return nrv; } \
+}; \
+ \
+template <class T, class U, class B = ::boost::detail::empty_base<T> > \
+struct BOOST_OPERATOR2_LEFT(NAME) : B \
+{ \
+ friend T operator OP( const U& lhs, const T& rhs ) \
+ { T nrv( lhs ); nrv OP##= rhs; return nrv; } \
+}; \
+ \
+template <class T, class B = ::boost::detail::empty_base<T> > \
+struct NAME##1 : B \
+{ \
+ friend T operator OP( const T& lhs, const T& rhs ) \
+ { T nrv( lhs ); nrv OP##= rhs; return nrv; } \
+};
+
+#else // defined(BOOST_HAS_NRVO) || defined(BOOST_FORCE_SYMMETRIC_OPERATORS)
+
+// For compilers without NRVO the following code is optimal, but not
+// symmetric! Note that the implementation of
+// BOOST_OPERATOR2_LEFT(NAME) only looks cool, but doesn't provide
+// optimization opportunities to the compiler :)
+
+#define BOOST_BINARY_OPERATOR_COMMUTATIVE( NAME, OP ) \
+template <class T, class U, class B = ::boost::detail::empty_base<T> > \
+struct NAME##2 : B \
+{ \
+ friend T operator OP( T lhs, const U& rhs ) { return lhs OP##= rhs; } \
+ friend T operator OP( const U& lhs, T rhs ) { return rhs OP##= lhs; } \
+}; \
+ \
+template <class T, class B = ::boost::detail::empty_base<T> > \
+struct NAME##1 : B \
+{ \
+ friend T operator OP( T lhs, const T& rhs ) { return lhs OP##= rhs; } \
+};
+
+#define BOOST_BINARY_OPERATOR_NON_COMMUTATIVE( NAME, OP ) \
+template <class T, class U, class B = ::boost::detail::empty_base<T> > \
+struct NAME##2 : B \
+{ \
+ friend T operator OP( T lhs, const U& rhs ) { return lhs OP##= rhs; } \
+}; \
+ \
+template <class T, class U, class B = ::boost::detail::empty_base<T> > \
+struct BOOST_OPERATOR2_LEFT(NAME) : B \
+{ \
+ friend T operator OP( const U& lhs, const T& rhs ) \
+ { return T( lhs ) OP##= rhs; } \
+}; \
+ \
+template <class T, class B = ::boost::detail::empty_base<T> > \
+struct NAME##1 : B \
+{ \
+ friend T operator OP( T lhs, const T& rhs ) { return lhs OP##= rhs; } \
+};
+
+#endif // defined(BOOST_HAS_NRVO) || defined(BOOST_FORCE_SYMMETRIC_OPERATORS)
+
+BOOST_BINARY_OPERATOR_COMMUTATIVE( multipliable, * )
+BOOST_BINARY_OPERATOR_COMMUTATIVE( addable, + )
+BOOST_BINARY_OPERATOR_NON_COMMUTATIVE( subtractable, - )
+BOOST_BINARY_OPERATOR_NON_COMMUTATIVE( dividable, / )
+BOOST_BINARY_OPERATOR_NON_COMMUTATIVE( modable, % )
+BOOST_BINARY_OPERATOR_COMMUTATIVE( xorable, ^ )
+BOOST_BINARY_OPERATOR_COMMUTATIVE( andable, & )
+BOOST_BINARY_OPERATOR_COMMUTATIVE( orable, | )
+
+#undef BOOST_BINARY_OPERATOR_COMMUTATIVE
+#undef BOOST_BINARY_OPERATOR_NON_COMMUTATIVE
+#undef BOOST_OPERATOR2_LEFT
// incrementable and decrementable contributed by Jeremy Siek
-template <class T, class B = ::boost::detail::empty_base>
+template <class T, class B = ::boost::detail::empty_base<T> >
struct incrementable : B
{
friend T operator++(T& x, int)
{
- incrementable_type tmp(x);
+ incrementable_type nrv(x);
++x;
- return tmp;
+ return nrv;
}
private: // The use of this typedef works around a Borland bug
typedef T incrementable_type;
};
-template <class T, class B = ::boost::detail::empty_base>
+template <class T, class B = ::boost::detail::empty_base<T> >
struct decrementable : B
{
friend T operator--(T& x, int)
{
- decrementable_type tmp(x);
+ decrementable_type nrv(x);
--x;
- return tmp;
+ return nrv;
}
private: // The use of this typedef works around a Borland bug
typedef T decrementable_type;
// Iterator operator classes (contributed by Jeremy Siek) ------------------//
-template <class T, class P, class B = ::boost::detail::empty_base>
+template <class T, class P, class B = ::boost::detail::empty_base<T> >
struct dereferenceable : B
{
P operator->() const
}
};
-template <class T, class I, class R, class B = ::boost::detail::empty_base>
+template <class T, class I, class R, class B = ::boost::detail::empty_base<T> >
struct indexable : B
{
R operator[](I n) const
};
// More operator classes (contributed by Daryle Walker) --------------------//
+// (NRVO-friendly implementation contributed by Daniel Frey) ---------------//
-template <class T, class U, class B = ::boost::detail::empty_base>
-struct left_shiftable2 : B
-{
- friend T operator<<(T x, const U& y) { return x <<= y; }
-};
+#if defined(BOOST_HAS_NRVO) || defined(BOOST_FORCE_SYMMETRIC_OPERATORS)
-template <class T, class B = ::boost::detail::empty_base>
-struct left_shiftable1 : B
-{
- friend T operator<<(T x, const T& y) { return x <<= y; }
+#define BOOST_BINARY_OPERATOR( NAME, OP ) \
+template <class T, class U, class B = ::boost::detail::empty_base<T> > \
+struct NAME##2 : B \
+{ \
+ friend T operator OP( const T& lhs, const U& rhs ) \
+ { T nrv( lhs ); nrv OP##= rhs; return nrv; } \
+}; \
+ \
+template <class T, class B = ::boost::detail::empty_base<T> > \
+struct NAME##1 : B \
+{ \
+ friend T operator OP( const T& lhs, const T& rhs ) \
+ { T nrv( lhs ); nrv OP##= rhs; return nrv; } \
};
-template <class T, class U, class B = ::boost::detail::empty_base>
-struct right_shiftable2 : B
-{
- friend T operator>>(T x, const U& y) { return x >>= y; }
-};
+#else // defined(BOOST_HAS_NRVO) || defined(BOOST_FORCE_SYMMETRIC_OPERATORS)
-template <class T, class B = ::boost::detail::empty_base>
-struct right_shiftable1 : B
-{
- friend T operator>>(T x, const T& y) { return x >>= y; }
+#define BOOST_BINARY_OPERATOR( NAME, OP ) \
+template <class T, class U, class B = ::boost::detail::empty_base<T> > \
+struct NAME##2 : B \
+{ \
+ friend T operator OP( T lhs, const U& rhs ) { return lhs OP##= rhs; } \
+}; \
+ \
+template <class T, class B = ::boost::detail::empty_base<T> > \
+struct NAME##1 : B \
+{ \
+ friend T operator OP( T lhs, const T& rhs ) { return lhs OP##= rhs; } \
};
-template <class T, class U, class B = ::boost::detail::empty_base>
+#endif // defined(BOOST_HAS_NRVO) || defined(BOOST_FORCE_SYMMETRIC_OPERATORS)
+
+BOOST_BINARY_OPERATOR( left_shiftable, << )
+BOOST_BINARY_OPERATOR( right_shiftable, >> )
+
+#undef BOOST_BINARY_OPERATOR
+
+template <class T, class U, class B = ::boost::detail::empty_base<T> >
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);
}
};
-template <class T, class B = ::boost::detail::empty_base>
+template <class T, class B = ::boost::detail::empty_base<T> >
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);
}
};
-template <class T, class U, class B = ::boost::detail::empty_base>
+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>
+template <class T, class B = ::boost::detail::empty_base<T> >
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) ----------------//
-template <class T, class U, class B = ::boost::detail::empty_base>
+template <class T, class U, class B = ::boost::detail::empty_base<T> >
struct totally_ordered2
: less_than_comparable2<T, U
, equality_comparable2<T, U, B
> > {};
-template <class T, class B = ::boost::detail::empty_base>
+template <class T, class B = ::boost::detail::empty_base<T> >
struct totally_ordered1
: less_than_comparable1<T
, equality_comparable1<T, B
> > {};
-template <class T, class U, class B = ::boost::detail::empty_base>
+template <class T, class U, class B = ::boost::detail::empty_base<T> >
struct additive2
: addable2<T, U
, subtractable2<T, U, B
> > {};
-template <class T, class B = ::boost::detail::empty_base>
+template <class T, class B = ::boost::detail::empty_base<T> >
struct additive1
: addable1<T
, subtractable1<T, B
> > {};
-template <class T, class U, class B = ::boost::detail::empty_base>
+template <class T, class U, class B = ::boost::detail::empty_base<T> >
struct multiplicative2
: multipliable2<T, U
, dividable2<T, U, B
> > {};
-template <class T, class B = ::boost::detail::empty_base>
+template <class T, class B = ::boost::detail::empty_base<T> >
struct multiplicative1
: multipliable1<T
, dividable1<T, B
> > {};
-template <class T, class U, class B = ::boost::detail::empty_base>
+template <class T, class U, class B = ::boost::detail::empty_base<T> >
struct integer_multiplicative2
: multiplicative2<T, U
, modable2<T, U, B
> > {};
-template <class T, class B = ::boost::detail::empty_base>
+template <class T, class B = ::boost::detail::empty_base<T> >
struct integer_multiplicative1
: multiplicative1<T
, modable1<T, B
> > {};
-template <class T, class U, class B = ::boost::detail::empty_base>
+template <class T, class U, class B = ::boost::detail::empty_base<T> >
struct arithmetic2
: additive2<T, U
, multiplicative2<T, U, B
> > {};
-template <class T, class B = ::boost::detail::empty_base>
+template <class T, class B = ::boost::detail::empty_base<T> >
struct arithmetic1
: additive1<T
, multiplicative1<T, B
> > {};
-template <class T, class U, class B = ::boost::detail::empty_base>
+template <class T, class U, class B = ::boost::detail::empty_base<T> >
struct integer_arithmetic2
: additive2<T, U
, integer_multiplicative2<T, U, B
> > {};
-template <class T, class B = ::boost::detail::empty_base>
+template <class T, class B = ::boost::detail::empty_base<T> >
struct integer_arithmetic1
: additive1<T
, integer_multiplicative1<T, B
> > {};
-template <class T, class U, class B = ::boost::detail::empty_base>
+template <class T, class U, class B = ::boost::detail::empty_base<T> >
struct bitwise2
: xorable2<T, U
, andable2<T, U
, orable2<T, U, B
> > > {};
-template <class T, class B = ::boost::detail::empty_base>
+template <class T, class B = ::boost::detail::empty_base<T> >
struct bitwise1
: xorable1<T
, andable1<T
, orable1<T, B
> > > {};
-template <class T, class B = ::boost::detail::empty_base>
+template <class T, class B = ::boost::detail::empty_base<T> >
struct unit_steppable
: incrementable<T
, decrementable<T, B
> > {};
-template <class T, class U, class B = ::boost::detail::empty_base>
+template <class T, class U, class B = ::boost::detail::empty_base<T> >
struct shiftable2
: left_shiftable2<T, U
, right_shiftable2<T, U, B
> > {};
-template <class T, class B = ::boost::detail::empty_base>
+template <class T, class B = ::boost::detail::empty_base<T> >
struct shiftable1
: left_shiftable1<T
, right_shiftable1<T, B
> > {};
-template <class T, class U, class B = ::boost::detail::empty_base>
+template <class T, class U, class B = ::boost::detail::empty_base<T> >
struct ring_operators2
: additive2<T, U
, subtractable2_left<T, U
, multipliable2<T, U, B
> > > {};
-template <class T, class B = ::boost::detail::empty_base>
+template <class T, class B = ::boost::detail::empty_base<T> >
struct ring_operators1
: additive1<T
, multipliable1<T, B
> > {};
-template <class T, class U, class B = ::boost::detail::empty_base>
+template <class T, class U, class B = ::boost::detail::empty_base<T> >
struct ordered_ring_operators2
: ring_operators2<T, U
, totally_ordered2<T, U, B
> > {};
-template <class T, class B = ::boost::detail::empty_base>
+template <class T, class B = ::boost::detail::empty_base<T> >
struct ordered_ring_operators1
: ring_operators1<T
, totally_ordered1<T, B
> > {};
-template <class T, class U, class B = ::boost::detail::empty_base>
+template <class T, class U, class B = ::boost::detail::empty_base<T> >
struct field_operators2
: ring_operators2<T, U
, dividable2<T, U
, dividable2_left<T, U, B
> > > {};
-template <class T, class B = ::boost::detail::empty_base>
+template <class T, class B = ::boost::detail::empty_base<T> >
struct field_operators1
: ring_operators1<T
, dividable1<T, B
> > {};
-template <class T, class U, class B = ::boost::detail::empty_base>
+template <class T, class U, class B = ::boost::detail::empty_base<T> >
struct ordered_field_operators2
: field_operators2<T, U
, totally_ordered2<T, U, B
> > {};
-template <class T, class B = ::boost::detail::empty_base>
+template <class T, class B = ::boost::detail::empty_base<T> >
struct ordered_field_operators1
: field_operators1<T
, totally_ordered1<T, B
> > {};
-template <class T, class U, class B = ::boost::detail::empty_base>
+template <class T, class U, class B = ::boost::detail::empty_base<T> >
struct euclidian_ring_operators2
: ring_operators2<T, U
, dividable2<T, U
, modable2_left<T, U, B
> > > > > {};
-template <class T, class B = ::boost::detail::empty_base>
+template <class T, class B = ::boost::detail::empty_base<T> >
struct euclidian_ring_operators1
: ring_operators1<T
, dividable1<T
, modable1<T, B
> > > {};
-template <class T, class U, class B = ::boost::detail::empty_base>
+template <class T, class U, class B = ::boost::detail::empty_base<T> >
struct ordered_euclidian_ring_operators2
: totally_ordered2<T, U
, euclidian_ring_operators2<T, U, B
> > {};
-template <class T, class B = ::boost::detail::empty_base>
+template <class T, class B = ::boost::detail::empty_base<T> >
struct ordered_euclidian_ring_operators1
: totally_ordered1<T
, euclidian_ring_operators1<T, B
> > {};
-
-template <class T, class P, class B = ::boost::detail::empty_base>
+
+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
, incrementable<T
, dereferenceable<T, P, B
> > > {};
-template <class T, class B = ::boost::detail::empty_base>
+template <class T, class B = ::boost::detail::empty_base<T> >
struct output_iteratable
: incrementable<T, B
> {};
-template <class T, class P, class B = ::boost::detail::empty_base>
+template <class T, class P, class B = ::boost::detail::empty_base<T> >
struct forward_iteratable
: input_iteratable<T, P, B
> {};
-template <class T, class P, class B = ::boost::detail::empty_base>
+template <class T, class P, class B = ::boost::detail::empty_base<T> >
struct bidirectional_iteratable
: forward_iteratable<T, P
, decrementable<T, B
// which is an indirect base class of bidirectional_iterable,
// random_access_iteratable must not be derived from totally_ordered1
// but from less_than_comparable1 only. (Helmut Zeisel, 02-Dec-2001)
-template <class T, class P, class D, class R, class B = ::boost::detail::empty_base>
+template <class T, class P, class D, class R, class B = ::boost::detail::empty_base<T> >
struct random_access_iteratable
: bidirectional_iteratable<T, P
, less_than_comparable1<T
// Otherwise, because a Borland C++ 5.5 bug prevents a using declaration
// from working, we are forced to use inheritance for that compiler.
-# define BOOST_IMPORT_TEMPLATE4(template_name) \
- template <class T, class U, class V, class W, class B = ::boost::detail::empty_base> \
+# define BOOST_IMPORT_TEMPLATE4(template_name) \
+ template <class T, class U, class V, class W, class B = ::boost::detail::empty_base<T> > \
struct template_name : ::template_name<T, U, V, W, B> {};
-# define BOOST_IMPORT_TEMPLATE3(template_name) \
- template <class T, class U, class V, class B = ::boost::detail::empty_base> \
+# define BOOST_IMPORT_TEMPLATE3(template_name) \
+ template <class T, class U, class V, class B = ::boost::detail::empty_base<T> > \
struct template_name : ::template_name<T, U, V, B> {};
-# define BOOST_IMPORT_TEMPLATE2(template_name) \
- template <class T, class U, class B = ::boost::detail::empty_base> \
+# define BOOST_IMPORT_TEMPLATE2(template_name) \
+ template <class T, class U, class B = ::boost::detail::empty_base<T> > \
struct template_name : ::template_name<T, U, B> {};
-# define BOOST_IMPORT_TEMPLATE1(template_name) \
- template <class T, class B = ::boost::detail::empty_base> \
+# define BOOST_IMPORT_TEMPLATE1(template_name) \
+ template <class T, class B = ::boost::detail::empty_base<T> > \
struct template_name : ::template_name<T, B> {};
# endif // BOOST_NO_USING_TEMPLATE
// Here's where we put it all together, defining the xxxx forms of the templates
// in namespace boost. We also define specializations of is_chained_base<> for
// the xxxx, xxxx1, and xxxx2 templates, importing them into boost:: as
-// neccessary.
+// necessary.
//
-#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
// is_chained_base<> - a traits class used to distinguish whether an operator
// template argument is being used for base class chaining, or is specifying a
} // namespace boost
-// Import a 4-type-argument operator template into boost (if neccessary) and
+// Import a 4-type-argument operator template into boost (if necessary) and
// provide a specialization of 'is_chained_base<>' for it.
# define BOOST_OPERATOR_TEMPLATE4(template_name4) \
BOOST_IMPORT_TEMPLATE4(template_name4) \
typedef ::boost::detail::true_t value; \
};
-// Import a 3-type-argument operator template into boost (if neccessary) and
+// Import a 3-type-argument operator template into boost (if necessary) and
// provide a specialization of 'is_chained_base<>' for it.
# define BOOST_OPERATOR_TEMPLATE3(template_name3) \
BOOST_IMPORT_TEMPLATE3(template_name3) \
typedef ::boost::detail::true_t value; \
};
-// Import a 2-type-argument operator template into boost (if neccessary) and
+// Import a 2-type-argument operator template into boost (if necessary) and
// provide a specialization of 'is_chained_base<>' for it.
# define BOOST_OPERATOR_TEMPLATE2(template_name2) \
BOOST_IMPORT_TEMPLATE2(template_name2) \
typedef ::boost::detail::true_t value; \
};
-// Import a 1-type-argument operator template into boost (if neccessary) and
+// Import a 1-type-argument operator template into boost (if necessary) and
// provide a specialization of 'is_chained_base<>' for it.
# define BOOST_OPERATOR_TEMPLATE1(template_name1) \
BOOST_IMPORT_TEMPLATE1(template_name1) \
# define BOOST_OPERATOR_TEMPLATE(template_name) \
template <class T \
,class U = T \
- ,class B = ::boost::detail::empty_base \
+ ,class B = ::boost::detail::empty_base<T> \
,class O = typename is_chained_base<U>::value \
> \
struct template_name : template_name##2<T, U, B> {}; \
BOOST_OPERATOR_TEMPLATE1(template_name##1)
-#else // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
-
-# define BOOST_OPERATOR_TEMPLATE4(template_name4) \
- BOOST_IMPORT_TEMPLATE4(template_name4)
-# define BOOST_OPERATOR_TEMPLATE3(template_name3) \
- BOOST_IMPORT_TEMPLATE3(template_name3)
-# define BOOST_OPERATOR_TEMPLATE2(template_name2) \
- BOOST_IMPORT_TEMPLATE2(template_name2)
-# define BOOST_OPERATOR_TEMPLATE1(template_name1) \
- BOOST_IMPORT_TEMPLATE1(template_name1)
-
- // In this case we can only assume that template_name<> is equivalent to the
- // more commonly needed template_name1<> form.
-# define BOOST_OPERATOR_TEMPLATE(template_name) \
- template <class T, class B = ::boost::detail::empty_base> \
- struct template_name : template_name##1<T, B> {};
-
-#endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
namespace boost {
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)
, bitwise2<T,U
> > > {};
-#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
template <class T, class U = T>
struct operators : operators2<T, U> {};
template <class T> struct operators<T, T>
-#else
-template <class T> struct operators
-#endif
: totally_ordered<T
, integer_arithmetic<T
, bitwise<T