diff --git a/include/boost/operators.hpp b/include/boost/operators.hpp
index 4b47ba4..b3b1bd7 100644
--- a/include/boost/operators.hpp
+++ b/include/boost/operators.hpp
@@ -8,9 +8,6 @@
// 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
@@ -127,34 +124,34 @@ namespace boost
template >
struct less_than_comparable2 : B
{
- friend bool operator<=(const T& x, const U& y) { return !static_cast(x > y); }
- friend bool operator>=(const T& x, const U& y) { return !static_cast(x < y); }
+ 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 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(y < x); }
- friend bool operator>=(const U& x, const T& y) { return !static_cast(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); }
};
template >
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 !static_cast(y < x); }
- friend bool operator>=(const T& x, const T& y) { return !static_cast(x < y); }
+ friend bool operator<=(const T& x, const T& y) { return !(y < x); }
+ friend bool operator>=(const T& x, const T& y) { return !(x < y); }
};
template >
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 !static_cast(x == y); }
- friend bool operator!=(const T& y, const U& x) { return !static_cast(y == x); }
+ friend bool operator!=(const U& y, const T& x) { return !(x == y); }
+ friend bool operator!=(const T& y, const U& x) { return !(y == x); }
};
template >
struct equality_comparable1 : B
{
- friend bool operator!=(const T& x, const T& y) { return !static_cast(x == y); }
+ friend bool operator!=(const T& x, const T& y) { return !(x == y); }
};
// A macro which produces "name_2left" from "name".
@@ -359,7 +356,7 @@ struct equivalent2 : B
{
friend bool operator==(const T& x, const U& y)
{
- return !static_cast(x < y) && !static_cast(x > y);
+ return !(x < y) && !(x > y);
}
};
@@ -368,7 +365,7 @@ struct equivalent1 : B
{
friend bool operator==(const T&x, const T&y)
{
- return !static_cast(x < y) && !static_cast(y < x);
+ return !(x < y) && !(y < x);
}
};
@@ -376,17 +373,17 @@ template >
struct partially_ordered2 : B
{
friend bool operator<=(const T& x, const U& y)
- { return static_cast(x < y) || static_cast(x == y); }
+ { return (x < y) || (x == y); }
friend bool operator>=(const T& x, const U& y)
- { return static_cast(x > y) || static_cast(x == y); }
+ { return (x > y) || (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 static_cast(y > x) || static_cast(y == x); }
+ { return (y > x) || (y == x); }
friend bool operator>=(const U& x, const T& y)
- { return static_cast(y < x) || static_cast(y == x); }
+ { return (y < x) || (y == x); }
};
template >
@@ -395,9 +392,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 static_cast(x < y) || static_cast(x == y); }
+ { return (x < y) || (x == y); }
friend bool operator>=(const T& x, const T& y)
- { return static_cast(y < x) || static_cast(x == y); }
+ { return (y < x) || (x == y); }
};
// Combined operator classes (contributed by Daryle Walker) ----------------//
@@ -583,35 +580,7 @@ struct ordered_euclidian_ring_operators1
: totally_ordered1 > {};
-
-template >
-struct euclidean_ring_operators2
- : ring_operators2 > > > > {};
-
-template >
-struct euclidean_ring_operators1
- : ring_operators1 > > {};
-
-template >
-struct ordered_euclidean_ring_operators2
- : totally_ordered2 > {};
-
-template >
-struct ordered_euclidean_ring_operators1
- : totally_ordered1 > {};
-
+
template >
struct input_iteratable
: equality_comparable1 inline typename unwrap_reference::type&
-unwrap_ref(T& t)
-{
- return t;
-}
-
} // namespace boost
#endif // #ifndef BOOST_REF_HPP_INCLUDED
diff --git a/include/boost/utility/detail/result_of_iterate.hpp b/include/boost/utility/detail/result_of_iterate.hpp
index 8de00b4..41616c3 100644
--- a/include/boost/utility/detail/result_of_iterate.hpp
+++ b/include/boost/utility/detail/result_of_iterate.hpp
@@ -10,47 +10,6 @@
# error Boost result_of - do not include this file!
#endif
-#if defined(BOOST_HAS_DECLTYPE)
-
-// As of N2588, C++0x result_of only supports function call
-// expressions of the form f(x). This precludes support for member
-// function pointers, which are invoked with expressions of the form
-// o->*f(x). This implementation supports both.
-template
-struct result_of
- : mpl::if_<
- mpl::or_< is_pointer, is_member_function_pointer >
- , detail::result_of_impl<
- typename remove_cv::type,
- typename remove_cv::type(BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(),T)), false
- >
- , detail::result_of_decltype_impl<
- F(BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(),T))
- >
- >::type
-{};
-
-namespace detail {
-
-# define BOOST_RESULT_OF_STATIC_MEMBERS(z, n, _) \
- static T ## n t ## n; \
- /**/
-
-template
-class result_of_decltype_impl
-{
- static F f;
- BOOST_PP_REPEAT(BOOST_PP_ITERATION(), BOOST_RESULT_OF_STATIC_MEMBERS, _)
-public:
- typedef decltype(f(BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(),t))) type;
-};
-
-} // namespace detail
-
-#else // defined(BOOST_HAS_DECLTYPE)
-
// CWPro8 requires an argument in a function type specialization
#if BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3002)) && BOOST_PP_ITERATION() == 0
# define BOOST_RESULT_OF_ARGS void
@@ -62,22 +21,11 @@ public:
template
struct result_of
- : mpl::if_<
- mpl::or_< is_pointer, is_member_function_pointer >
- , boost::detail::result_of_impl<
- typename remove_cv::type,
- typename remove_cv::type(BOOST_RESULT_OF_ARGS),
- (boost::detail::has_result_type::value)>
- , boost::detail::result_of_impl<
- F,
- F(BOOST_RESULT_OF_ARGS),
- (boost::detail::has_result_type::value)> >::type { };
+ : boost::detail::result_of_impl::value)> {};
#endif
#undef BOOST_RESULT_OF_ARGS
-#endif // defined(BOOST_HAS_DECLTYPE)
-
#if BOOST_PP_ITERATION() >= 1
namespace detail {
diff --git a/include/boost/utility/result_of.hpp b/include/boost/utility/result_of.hpp
index d8baa3e..cdcac34 100644
--- a/include/boost/utility/result_of.hpp
+++ b/include/boost/utility/result_of.hpp
@@ -10,18 +10,13 @@
#define BOOST_RESULT_OF_HPP
#include
-#include
-#include
-#include
-#include
+#include
+#include
+#include
#include
#include
#include
#include
-#include
-#include
-#include
-#include
#ifndef BOOST_RESULT_OF_NUM_ARGS
# define BOOST_RESULT_OF_NUM_ARGS 10
@@ -37,7 +32,6 @@ namespace detail {
BOOST_MPL_HAS_XXX_TRAIT_DEF(result_type)
template struct result_of_impl;
-template struct result_of_decltype_impl;
template
struct result_of_void_impl
@@ -57,11 +51,6 @@ struct result_of_void_impl
typedef R type;
};
-// Determine the return type of a function pointer or pointer to member.
-template
-struct result_of_pointer
- : result_of_impl::type, FArgs, false> { };
-
template
struct result_of_impl
{
diff --git a/include/boost/utility/value_init.hpp b/include/boost/utility/value_init.hpp
index aa7ecb4..67127c0 100644
--- a/include/boost/utility/value_init.hpp
+++ b/include/boost/utility/value_init.hpp
@@ -7,7 +7,6 @@
// 21 Ago 2002 (Created) Fernando Cacciola
// 24 Dec 2007 (Refactored and worked around various compiler bugs) Fernando Cacciola, Niels Dekker
// 23 May 2008 (Fixed operator= const issue, added initialized_value) Niels Dekker, Fernando Cacciola
-// 21 Ago 2008 (Added swap) Niels Dekker, Fernando Cacciola
//
#ifndef BOOST_UTILITY_VALUE_INIT_21AGO2002_HPP
#define BOOST_UTILITY_VALUE_INIT_21AGO2002_HPP
@@ -23,7 +22,6 @@
#include
#include
#include
-#include
#include
#include
@@ -95,11 +93,6 @@ class value_initialized
return wrapper_address()->data;
}
- void swap(value_initialized & arg)
- {
- ::boost::swap( this->data(), arg.data() );
- }
-
operator T&() const { return this->data(); }
} ;
@@ -117,12 +110,6 @@ T& get ( value_initialized& x )
return x.data() ;
}
-template
-void swap ( value_initialized & lhs, value_initialized & rhs )
-{
- lhs.swap(rhs) ;
-}
-
class initialized_value_t
{
diff --git a/index.html b/index.html
index 5af6f75..ff22fb4 100644
--- a/index.html
+++ b/index.html
@@ -24,7 +24,6 @@
iterator_adaptors
generator iterator adaptors
operators
- swap
throw_exception
utility
value_init
diff --git a/operators.htm b/operators.htm
index a33e814..cfe77da 100644
--- a/operators.htm
+++ b/operators.htm
@@ -1420,9 +1420,9 @@ T operator+( T lhs, const T& rhs )
euclidean_ring_operators<T>
+ "euclidian_ring_operators1">euclidian_ring_operators<T>
- euclidean_ring_operators1<T> |
+ euclidian_ring_operators1<T>
@@ -1439,9 +1439,9 @@ T operator+( T lhs, const T& rhs )
euclidean_ring_operators<T,
+ "euclidian_ring_operators2">euclidian_ring_operators<T,
U>
- euclidean_ring_operators2<T, U> |
+ euclidian_ring_operators2<T, U>
@@ -1464,14 +1464,14 @@ T operator+( T lhs, const T& rhs )
ordered_euclidean_ring_operators<T>
+ "ordered_euclidian_ring_operators1">ordered_euclidian_ring_operators<T>
- ordered_euclidean_ring_operators1<T> |
+ ordered_euclidian_ring_operators1<T>
euclidean_ring_operators<T>
+ "#euclidian_ring_operators1">euclidian_ring_operators<T>
totally_ordered<T>
@@ -1481,14 +1481,14 @@ T operator+( T lhs, const T& rhs )
ordered_euclidean_ring_operators<T,
+ "ordered_euclidian_ring_operators2">ordered_euclidian_ring_operators<T,
U>
- ordered_euclidean_ring_operators2<T, U> |
+ ordered_euclidian_ring_operators2<T, U>
|
- Spelling: euclidean vs. euclidian
-
- Older versions of the Boost.Operators library used
- "euclidian ", but it was pointed out that
- "euclidean " is the more common spelling.
- To be compatible with older version, the library now supports
- both spellings.
-
-
The arithmetic operator class templates The operators_test.cpp
program demonstrates the use of the arithmetic operator templates, and
- can also be used to verify correct operation. Check the compiler status
- report for the test results with selected platforms.
+ can also be used to verify correct operation. Check the compiler status report for the
+ test results with selected platforms.
Dereference Operators and Iterator Helpers
@@ -2127,10 +2119,10 @@ public:
backward-compatible.
- Revised: 7 Aug 2008
+ Revised: 29 Oct 2004
Copyright © Beman Dawes, David Abrahams, 1999-2001.
- Copyright © Daniel Frey, 2002-2008.
+ Copyright © Daniel Frey, 2002-2004.
Use, modification, and distribution is subject to the Boost Software
License, Version 1.0. (See accompanying file
LICENSE_1_0.txt or copy at
diff --git a/operators_test.cpp b/operators_test.cpp
index 5b71f3a..d42cb6a 100644
--- a/operators_test.cpp
+++ b/operators_test.cpp
@@ -7,7 +7,6 @@
// 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
@@ -44,23 +43,6 @@ namespace
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
@@ -72,10 +54,8 @@ namespace
explicit Wrapped1( T v = T() ) : _value(v) {}
T value() const { return _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; }
+ bool operator<(const Wrapped1& x) const { return _value < x._value; }
+ bool operator==(const Wrapped1& x) const { return _value == x._value; }
Wrapped1& operator+=(const Wrapped1& x)
{ _value += x._value; return *this; }
@@ -117,10 +97,8 @@ namespace
explicit Wrapped2( T v = T() ) : _value(v) {}
T value() const { return _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; }
+ bool operator<(const Wrapped2& x) const { return _value < x._value; }
+ bool operator==(const Wrapped2& x) const { return _value == x._value; }
Wrapped2& operator+=(const Wrapped2& x)
{ _value += x._value; return *this; }
@@ -145,13 +123,9 @@ namespace
Wrapped2& operator++() { ++_value; return *this; }
Wrapped2& operator--() { --_value; return *this; }
- 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; }
-
+ bool operator<(U u) const { return _value < u; }
+ bool operator>(U u) const { return _value > u; }
+ 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; }
@@ -179,8 +153,7 @@ namespace
explicit Wrapped3( T v = T() ) : _value(v) {}
T value() const { return _value; }
- convertible_to_bool operator<(const Wrapped3& x) const
- { return _value < x._value; }
+ bool operator<(const Wrapped3& x) const { return _value < x._value; }
private:
T _value;
@@ -201,13 +174,10 @@ namespace
explicit Wrapped4( T v = T() ) : _value(v) {}
T value() const { return _value; }
- convertible_to_bool operator<(const Wrapped4& x) const
- { return _value < x._value; }
+ bool operator<(const Wrapped4& 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; }
+ bool operator<(U u) const { return _value < u; }
+ bool operator>(U u) const { return _value > u; }
private:
T _value;
@@ -228,18 +198,11 @@ namespace
Wrapped5(U u) : _value(u) {}
T value() const { return _value; }
-
- 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; }
-
+ 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; }
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;}
@@ -258,8 +221,8 @@ namespace
// U must be convertible to T
template
class Wrapped6
- : boost::ordered_euclidean_ring_operators2, U>
- , boost::ordered_euclidean_ring_operators1 >
+ : boost::ordered_euclidian_ring_operators2, U>
+ , boost::ordered_euclidian_ring_operators1 >
{
public:
explicit Wrapped6( T v = T() ) : _value(v) {}
@@ -268,18 +231,11 @@ namespace
Wrapped6(U u) : _value(u) {}
T value() const { return _value; }
-
- 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; }
-
+ 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; }
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;}
@@ -320,10 +276,10 @@ namespace
template
void test_less_than_comparable_aux(X1 x1, Y1 y1, X2 x2, Y2 y2)
{
- BOOST_CHECK( static_cast(x1 < y1) == static_cast(x2 < y2) );
- BOOST_CHECK( static_cast(x1 <= y1) == static_cast(x2 <= y2) );
- BOOST_CHECK( static_cast(x1 >= y1) == static_cast(x2 >= y2) );
- BOOST_CHECK( static_cast(x1 > y1) == static_cast(x2 > 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) );
}
template
@@ -337,8 +293,8 @@ namespace
template
void test_equality_comparable_aux(X1 x1, Y1 y1, X2 x2, Y2 y2)
{
- BOOST_CHECK( static_cast(x1 == y1) == static_cast(x2 == y2) );
- BOOST_CHECK( static_cast(x1 != y1) == static_cast(x2 != y2) );
+ BOOST_CHECK( (x1 == y1) == (x2 == y2) );
+ BOOST_CHECK( (x1 != y1) == (x2 != y2) );
}
template
@@ -658,14 +614,14 @@ test_main( int , char * [] )
PRIVATE_EXPR_TEST( (i = i2), (i.value() == 2) );
- BOOST_CHECK( static_cast(i2 == i) );
- BOOST_CHECK( static_cast(i1 != i2) );
- BOOST_CHECK( static_cast(i1 < i2) );
- BOOST_CHECK( static_cast(i1 <= i2) );
- BOOST_CHECK( static_cast(i <= i2) );
- BOOST_CHECK( static_cast(i2 > i1) );
- BOOST_CHECK( static_cast(i2 >= i1) );
- BOOST_CHECK( static_cast(i2 >= i) );
+ 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 );
PRIVATE_EXPR_TEST( (i = i1 + i2), (i.value() == 3) );
PRIVATE_EXPR_TEST( (i = i + i2), (i.value() == 5) );
@@ -697,78 +653,78 @@ test_main( int , char * [] )
PRIVATE_EXPR_TEST( (j = j2), (j.value() == 2) );
- BOOST_CHECK( static_cast(j2 == j) );
- BOOST_CHECK( static_cast(2 == j) );
- BOOST_CHECK( static_cast(j2 == 2) );
- BOOST_CHECK( static_cast(j == j2) );
- BOOST_CHECK( static_cast(j1 != j2) );
- BOOST_CHECK( static_cast(j1 != 2) );
- BOOST_CHECK( static_cast(1 != j2) );
- BOOST_CHECK( static_cast(j1 < j2) );
- BOOST_CHECK( static_cast(1 < j2) );
- BOOST_CHECK( static_cast(j1 < 2) );
- BOOST_CHECK( static_cast(j1 <= j2) );
- BOOST_CHECK( static_cast(1 <= j2) );
- BOOST_CHECK( static_cast(j1 <= j) );
- BOOST_CHECK( static_cast(j <= j2) );
- BOOST_CHECK( static_cast(2 <= j2) );
- BOOST_CHECK( static_cast(j <= 2) );
- BOOST_CHECK( static_cast(j2 > j1) );
- BOOST_CHECK( static_cast(2 > j1) );
- BOOST_CHECK( static_cast(j2 > 1) );
- BOOST_CHECK( static_cast(j2 >= j1) );
- BOOST_CHECK( static_cast(2 >= j1) );
- BOOST_CHECK( static_cast(j2 >= 1) );
- BOOST_CHECK( static_cast(j2 >= j) );
- BOOST_CHECK( static_cast(2 >= j) );
- BOOST_CHECK( static_cast(j2 >= 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((j1 + 2) == 3) );
- BOOST_CHECK( static_cast((1 + j2) == 3) );
+ BOOST_CHECK( (j1 + 2) == 3 );
+ BOOST_CHECK( (1 + j2) == 3 );
PRIVATE_EXPR_TEST( (j = j1 + j2), (j.value() == 3) );
- BOOST_CHECK( static_cast((j + 2) == 5) );
- BOOST_CHECK( static_cast((3 + j2) == 5) );
+ BOOST_CHECK( (j + 2) == 5 );
+ BOOST_CHECK( (3 + j2) == 5 );
PRIVATE_EXPR_TEST( (j = j + j2), (j.value() == 5) );
- BOOST_CHECK( static_cast((j - 1) == 4) );
+ BOOST_CHECK( (j - 1) == 4 );
PRIVATE_EXPR_TEST( (j = j - j1), (j.value() == 4) );
- BOOST_CHECK( static_cast((j * 2) == 8) );
- BOOST_CHECK( static_cast((4 * j2) == 8) );
+ BOOST_CHECK( (j * 2) == 8 );
+ BOOST_CHECK( (4 * j2) == 8 );
PRIVATE_EXPR_TEST( (j = j * j2), (j.value() == 8) );
- BOOST_CHECK( static_cast((j / 2) == 4) );
+ BOOST_CHECK( (j / 2) == 4 );
PRIVATE_EXPR_TEST( (j = j / j2), (j.value() == 4) );
- BOOST_CHECK( static_cast((j % 3) == 1) );
+ BOOST_CHECK( (j % 3) == 1 );
PRIVATE_EXPR_TEST( (j = j % ( j - j1 )), (j.value() == 1) );
PRIVATE_EXPR_TEST( (j = j2 + j2), (j.value() == 4) );
- BOOST_CHECK( static_cast((1 | j2 | j) == 7) );
- BOOST_CHECK( static_cast((j1 | 2 | j) == 7) );
- BOOST_CHECK( static_cast((j1 | j2 | 4) == 7) );
+ BOOST_CHECK( (1 | j2 | j) == 7 );
+ BOOST_CHECK( (j1 | 2 | j) == 7 );
+ BOOST_CHECK( (j1 | j2 | 4) == 7 );
PRIVATE_EXPR_TEST( (j = j1 | j2 | j), (j.value() == 7) );
- BOOST_CHECK( static_cast((7 & j2) == 2) );
- BOOST_CHECK( static_cast((j & 2) == 2) );
+ BOOST_CHECK( (7 & j2) == 2 );
+ BOOST_CHECK( (j & 2) == 2 );
PRIVATE_EXPR_TEST( (j = j & j2), (j.value() == 2) );
PRIVATE_EXPR_TEST( (j = j | j1), (j.value() == 3) );
- BOOST_CHECK( static_cast((3 ^ j1) == 2) );
- BOOST_CHECK( static_cast((j ^ 1) == 2) );
+ BOOST_CHECK( (3 ^ j1) == 2 );
+ BOOST_CHECK( (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( static_cast((j1 << 2) == 4) );
- BOOST_CHECK( static_cast((j2 << 1) == 4) );
+ BOOST_CHECK( (j1 << 2) == 4 );
+ BOOST_CHECK( (j2 << 1) == 4 );
PRIVATE_EXPR_TEST( (j = j1 << j2), (j.value() == 4) );
- BOOST_CHECK( static_cast((j >> 2) == 1) );
- BOOST_CHECK( static_cast((j2 >> 1) == 1) );
+ BOOST_CHECK( (j >> 2) == 1 );
+ BOOST_CHECK( (j2 >> 1) == 1 );
PRIVATE_EXPR_TEST( (j = j2 >> j1), (j.value() == 1) );
cout << "Performed tests on MyLong objects.\n";
@@ -785,14 +741,14 @@ test_main( int , char * [] )
PRIVATE_EXPR_TEST( (k = k2), (k.value() == 2) );
- BOOST_CHECK( static_cast(k2 == k) );
- BOOST_CHECK( static_cast(k1 != k2) );
- BOOST_CHECK( static_cast(k1 < k2) );
- BOOST_CHECK( static_cast(k1 <= k2) );
- BOOST_CHECK( static_cast(k <= k2) );
- BOOST_CHECK( static_cast(k2 > k1) );
- BOOST_CHECK( static_cast(k2 >= k1) );
- BOOST_CHECK( static_cast(k2 >= k) );
+ 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 );
cout << "Performed tests on MyChar objects.\n";
@@ -808,31 +764,31 @@ test_main( int , char * [] )
PRIVATE_EXPR_TEST( (l = l2), (l.value() == 2) );
- BOOST_CHECK( static_cast(l2 == l) );
- BOOST_CHECK( static_cast(2 == l) );
- BOOST_CHECK( static_cast(l2 == 2) );
- BOOST_CHECK( static_cast(l == l2) );
- BOOST_CHECK( static_cast(l1 != l2) );
- BOOST_CHECK( static_cast(l1 != 2) );
- BOOST_CHECK( static_cast(1 != l2) );
- BOOST_CHECK( static_cast(l1 < l2) );
- BOOST_CHECK( static_cast(1 < l2) );
- BOOST_CHECK( static_cast(l1 < 2) );
- BOOST_CHECK( static_cast(l1 <= l2) );
- BOOST_CHECK( static_cast(1 <= l2) );
- BOOST_CHECK( static_cast(l1 <= l) );
- BOOST_CHECK( static_cast(l <= l2) );
- BOOST_CHECK( static_cast(2 <= l2) );
- BOOST_CHECK( static_cast(l <= 2) );
- BOOST_CHECK( static_cast(l2 > l1) );
- BOOST_CHECK( static_cast(2 > l1) );
- BOOST_CHECK( static_cast(l2 > 1) );
- BOOST_CHECK( static_cast(l2 >= l1) );
- BOOST_CHECK( static_cast(2 >= l1) );
- BOOST_CHECK( static_cast(l2 >= 1) );
- BOOST_CHECK( static_cast(l2 >= l) );
- BOOST_CHECK( static_cast(2 >= l) );
- BOOST_CHECK( static_cast(l2 >= 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 );
cout << "Performed tests on MyShort objects.\n";
@@ -851,37 +807,37 @@ test_main( int , char * [] )
PRIVATE_EXPR_TEST( (di = di2), (di.value() == 2) );
- BOOST_CHECK( static_cast(di2 == di) );
- BOOST_CHECK( static_cast(2 == di) );
- BOOST_CHECK( static_cast(di == 2) );
- BOOST_CHECK( static_cast(di1 < di2) );
- BOOST_CHECK( static_cast(1 < di2) );
- BOOST_CHECK( static_cast(di1 <= di2) );
- BOOST_CHECK( static_cast(1 <= di2) );
- BOOST_CHECK( static_cast(di2 > di1) );
- BOOST_CHECK( static_cast(di2 > 1) );
- BOOST_CHECK( static_cast(di2 >= di1) );
- BOOST_CHECK( static_cast(di2 >= 1) );
- BOOST_CHECK( static_cast(di1 / di2 == half) );
- BOOST_CHECK( static_cast(di1 / 2 == half) );
- BOOST_CHECK( static_cast(1 / di2 == half) );
- PRIVATE_EXPR_TEST( (tmp=di1), static_cast((tmp/=2) == half) );
- PRIVATE_EXPR_TEST( (tmp=di1), static_cast((tmp/=di2) == half) );
- BOOST_CHECK( static_cast(di1 * di2 == di2) );
- BOOST_CHECK( static_cast(di1 * 2 == di2) );
- BOOST_CHECK( static_cast(1 * di2 == di2) );
- PRIVATE_EXPR_TEST( (tmp=di1), static_cast((tmp*=2) == di2) );
- PRIVATE_EXPR_TEST( (tmp=di1), static_cast((tmp*=di2) == di2) );
- BOOST_CHECK( static_cast(di2 - di1 == di1) );
- BOOST_CHECK( static_cast(di2 - 1 == di1) );
- BOOST_CHECK( static_cast(2 - di1 == di1) );
- PRIVATE_EXPR_TEST( (tmp=di2), static_cast((tmp-=1) == di1) );
- PRIVATE_EXPR_TEST( (tmp=di2), static_cast((tmp-=di1) == di1) );
- BOOST_CHECK( static_cast(di1 + di1 == di2) );
- BOOST_CHECK( static_cast(di1 + 1 == di2) );
- BOOST_CHECK( static_cast(1 + di1 == di2) );
- PRIVATE_EXPR_TEST( (tmp=di1), static_cast((tmp+=1) == di2) );
- PRIVATE_EXPR_TEST( (tmp=di1), static_cast((tmp+=di1) == di2) );
+ 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) );
cout << "Performed tests on MyDoubleInt objects.\n";
@@ -898,42 +854,42 @@ test_main( int , char * [] )
PRIVATE_EXPR_TEST( (li = li2), (li.value() == 2) );
- BOOST_CHECK( static_cast(li2 == li) );
- BOOST_CHECK( static_cast(2 == li) );
- BOOST_CHECK( static_cast(li == 2) );
- BOOST_CHECK( static_cast(li1 < li2) );
- BOOST_CHECK( static_cast(1 < li2) );
- BOOST_CHECK( static_cast(li1 <= li2) );
- BOOST_CHECK( static_cast(1 <= li2) );
- BOOST_CHECK( static_cast(li2 > li1) );
- BOOST_CHECK( static_cast(li2 > 1) );
- BOOST_CHECK( static_cast(li2 >= li1) );
- BOOST_CHECK( static_cast(li2 >= 1) );
- BOOST_CHECK( static_cast(li1 % li2 == li1) );
- BOOST_CHECK( static_cast(li1 % 2 == li1) );
- BOOST_CHECK( static_cast(1 % li2 == li1) );
- PRIVATE_EXPR_TEST( (tmp2=li1), static_cast((tmp2%=2) == li1) );
- PRIVATE_EXPR_TEST( (tmp2=li1), static_cast((tmp2%=li2) == li1) );
- BOOST_CHECK( static_cast(li1 / li2 == 0) );
- BOOST_CHECK( static_cast(li1 / 2 == 0) );
- BOOST_CHECK( static_cast(1 / li2 == 0) );
- PRIVATE_EXPR_TEST( (tmp2=li1), static_cast((tmp2/=2) == 0) );
- PRIVATE_EXPR_TEST( (tmp2=li1), static_cast((tmp2/=li2) == 0) );
- BOOST_CHECK( static_cast(li1 * li2 == li2) );
- BOOST_CHECK( static_cast(li1 * 2 == li2) );
- BOOST_CHECK( static_cast(1 * li2 == li2) );
- PRIVATE_EXPR_TEST( (tmp2=li1), static_cast((tmp2*=2) == li2) );
- PRIVATE_EXPR_TEST( (tmp2=li1), static_cast((tmp2*=li2) == li2) );
- BOOST_CHECK( static_cast(li2 - li1 == li1) );
- BOOST_CHECK( static_cast(li2 - 1 == li1) );
- BOOST_CHECK( static_cast(2 - li1 == li1) );
- PRIVATE_EXPR_TEST( (tmp2=li2), static_cast((tmp2-=1) == li1) );
- PRIVATE_EXPR_TEST( (tmp2=li2), static_cast((tmp2-=li1) == li1) );
- BOOST_CHECK( static_cast(li1 + li1 == li2) );
- BOOST_CHECK( static_cast(li1 + 1 == li2) );
- BOOST_CHECK( static_cast(1 + li1 == li2) );
- PRIVATE_EXPR_TEST( (tmp2=li1), static_cast((tmp2+=1) == li2) );
- PRIVATE_EXPR_TEST( (tmp2=li1), static_cast((tmp2+=li1) == li2) );
+ 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) );
cout << "Performed tests on MyLongInt objects.\n";
diff --git a/ref_test.cpp b/ref_test.cpp
index d4237b4..63fc9e5 100644
--- a/ref_test.cpp
+++ b/ref_test.cpp
@@ -68,54 +68,11 @@ struct ref_wrapper
}
};
-struct copy_counter {
- static int count_;
- copy_counter(copy_counter const& other) {
- ++count_;
- }
- copy_counter() {}
- static void reset() { count_ = 0; }
- static int count() { return copy_counter::count_; }
-};
-
-int copy_counter::count_ = 0;
-
} // namespace unnamed
-template
-void do_unwrap(T t) {
-
- /* typename unwrap_reference::type& lt = */
- unwrap_ref(t);
-
-}
-
-void unwrap_test() {
-
- int i = 3;
- const int ci = 2;
-
- do_unwrap(i);
- do_unwrap(ci);
- do_unwrap(ref(i));
- do_unwrap(cref(ci));
- do_unwrap(ref(ci));
-
- copy_counter cc;
- BOOST_CHECK(cc.count() == 0);
-
- do_unwrap(cc);
- do_unwrap(ref(cc));
- do_unwrap(cref(cc));
-
- BOOST_CHECK(cc.count() == 1);
- BOOST_CHECK(unwrap_ref(ref(cc)).count() == 1);
-}
-
int test_main(int, char * [])
{
ref_wrapper::test(1);
ref_wrapper::test(1);
- unwrap_test();
return 0;
}
diff --git a/test/result_of_test.cpp b/test/result_of_test.cpp
index 73dc757..10f3410 100644
--- a/test/result_of_test.cpp
+++ b/test/result_of_test.cpp
@@ -11,101 +11,35 @@
#include
#include
-struct int_result_type
-{
- typedef int result_type;
- result_type operator()(float);
-};
+struct int_result_type { typedef int result_type; };
struct int_result_of
{
template struct result { typedef int type; };
- result::type operator()(double);
- result::type operator()(double) const;
- result::type operator()();
- result::type operator()() volatile;
};
-struct int_result_type_and_float_result_of_and_char_return
+struct int_result_type_and_float_result_of
{
typedef int result_type;
template struct result { typedef float type; };
- char operator()(char);
};
template
-struct int_result_type_template
-{
- typedef int result_type;
- result_type operator()(float);
-};
+struct int_result_type_template { typedef int result_type; };
template
struct int_result_of_template
{
template struct result;
template struct result { typedef int type; };
- typename result(double)>::type operator()(double);
- typename result(double)>::type operator()(double) const;
- typename result(double)>::type operator()();
- typename result(double)>::type operator()() volatile;
};
template
-struct int_result_type_and_float_result_of_and_char_return_template
+struct int_result_type_and_float_result_of_template
{
typedef int result_type;
template struct result;
template struct result { typedef float type; };
- char operator()(char);
-};
-
-struct result_of_member_function_template
-{
- template struct result;
-
- template struct result { typedef That type; };
- template typename result::type operator()(T);
-
- template struct result { typedef const That type; };
- template typename result::type operator()(T) const;
-
- template struct result { typedef volatile That type; };
- template typename result::type operator()(T) volatile;
-
- template struct result { typedef const volatile That type; };
- template typename result::type operator()(T) const volatile;
-
- template struct result { typedef That & type; };
- template typename result::type operator()(T &, T);
-
- template struct result { typedef That const & type; };
- template typename result::type operator()(T const &, T);
-
- template struct result { typedef That volatile & type; };
- template typename result::type operator()(T volatile &, T);
-
- template struct result { typedef That const volatile & type; };
- template typename result::type operator()(T const volatile &, T);
-};
-
-struct no_result_type_or_result_of
-{
- int operator()(double);
- short operator()(double) const;
- unsigned int operator()();
- unsigned short operator()() volatile;
- const unsigned short operator()() const volatile;
-};
-
-template
-struct no_result_type_or_result_of_template
-{
- int operator()(double);
- short operator()(double) const;
- unsigned int operator()();
- unsigned short operator()() volatile;
- const unsigned short operator()() const volatile;
};
struct X {};
@@ -126,37 +60,16 @@ int main()
BOOST_STATIC_ASSERT((is_same::type, int>::value));
BOOST_STATIC_ASSERT((is_same::type, int>::value));
+ BOOST_STATIC_ASSERT((is_same::type, void>::value));
BOOST_STATIC_ASSERT((is_same::type, int>::value));
+ BOOST_STATIC_ASSERT((is_same::type, void>::value));
+ BOOST_STATIC_ASSERT((is_same::type, int>::value));
BOOST_STATIC_ASSERT((is_same(float)>::type, int>::value));
BOOST_STATIC_ASSERT((is_same(double)>::type, int>::value));
- BOOST_STATIC_ASSERT((is_same(double)>::type, int>::value));
-
- // Prior to decltype, result_of could not deduce the return type
- // nullary function objects unless they exposed a result_type.
-#if defined(BOOST_HAS_DECLTYPE)
- BOOST_STATIC_ASSERT((is_same | | |