From 0cd918935734ccdbf06bc558f144ce662580ad71 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Bron?= Date: Wed, 12 Oct 2011 19:41:11 +0000 Subject: [PATCH] operator traits: merged trunk->release (patch to make clang work) [SVN r74930] --- .../category/value_traits/operators.html | 38 +++++++-------- doc/html/index.html | 4 +- doc/html/index/s11.html | 2 +- doc/html/index/s12.html | 2 +- doc/html/index/s13.html | 2 +- doc/html/index/s14.html | 2 +- doc/operators.qbk | 38 +++++++-------- .../detail/has_binary_operator.hpp | 42 ++++++++-------- .../detail/has_postfix_operator.hpp | 48 ++++++++++--------- .../detail/has_prefix_operator.hpp | 42 ++++++++-------- 10 files changed, 111 insertions(+), 109 deletions(-) diff --git a/doc/html/boost_typetraits/category/value_traits/operators.html b/doc/html/boost_typetraits/category/value_traits/operators.html index eba7f16..82c062c 100644 --- a/doc/html/boost_typetraits/category/value_traits/operators.html +++ b/doc/html/boost_typetraits/category/value_traits/operators.html @@ -1168,7 +1168,23 @@ template <typename T> T &make(); -// 2. checks if the operator returns void or not +// 2. we provide our operator definition for types that do not have one already + +// a type returned from operator- when no such operator is +// found in the type's own namespace (our own operator is used) so that we have +// a means to know that our operator was used +struct no_operator { }; + +// this class allows implicit conversions and makes the following operator +// definition less-preferred than any other such operators that might be found +// via argument-dependent name lookup +struct any { template <class T> any(T const&); }; + +// when operator- is not available, this one is used +no_operator operator-(const any&); + + +// 3. checks if the operator returns void or not // conditions: Rhs!=void // we first redefine "operator," so that we have no compilation error if @@ -1193,7 +1209,7 @@ }; -// 3. checks if the return type is Ret or Ret==dont_care +// 4. checks if the return type is Ret or Ret==dont_care // conditions: Rhs!=void struct dont_care { }; @@ -1238,22 +1254,6 @@ }; -// 4. we provide our operator definition for types that do not have one already - -// a type returned from operator- when no such operator is -// found in the type's own namespace (our own operator is used) so that we have -// a means to know that our operator was used -struct no_operator { }; - -// this class allows implicit conversions and makes the following operator -// definition less-preferred than any other such operators that might be found -// via argument-dependent name lookup -struct any { template <class T> any(T const&); }; - -// when operator- is not available, this one is used -no_operator operator-(const any&); - - // 5. checks for operator existence // condition: Rhs!=void @@ -1272,7 +1272,7 @@ }; -// 5. main trait: to avoid any compilation error, this class behaves +// 6. main trait: to avoid any compilation error, this class behaves // differently when operator-(Rhs) is forbidden by the standard. // Forbidden_if is a bool that is: // - true when the operator-(Rhs) is forbidden by the standard diff --git a/doc/html/index.html b/doc/html/index.html index 0cc7c78..8cef6df 100644 --- a/doc/html/index.html +++ b/doc/html/index.html @@ -31,7 +31,7 @@ Ottosen, Roman Perepelitsa, Robert Ramey, Jeremy Siek, Robert Stewart and Steven Watanabe

-

+

Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

@@ -212,7 +212,7 @@

- +

Last revised: August 22, 2011 at 19:22:32 +0200

Last revised: October 07, 2011 at 23:05:54 +0200


diff --git a/doc/html/index/s11.html b/doc/html/index/s11.html index 8c92c7d..3b41cde 100644 --- a/doc/html/index/s11.html +++ b/doc/html/index/s11.html @@ -24,7 +24,7 @@

-Class Index

+Class Index

A C D E F H I M N O P R T

diff --git a/doc/html/index/s12.html b/doc/html/index/s12.html index 8c11ae0..bb1e17b 100644 --- a/doc/html/index/s12.html +++ b/doc/html/index/s12.html @@ -24,7 +24,7 @@

-Typedef Index

+Typedef Index

F R T

diff --git a/doc/html/index/s13.html b/doc/html/index/s13.html index 8cfa58a..242d831 100644 --- a/doc/html/index/s13.html +++ b/doc/html/index/s13.html @@ -24,7 +24,7 @@

-Macro Index

+Macro Index

B

diff --git a/doc/html/index/s14.html b/doc/html/index/s14.html index 5f3f48d..a4ab146 100644 --- a/doc/html/index/s14.html +++ b/doc/html/index/s14.html @@ -23,7 +23,7 @@

-Index

+Index

A B C D E F H I M N O P R T U

diff --git a/doc/operators.qbk b/doc/operators.qbk index f5290e0..8789335 100644 --- a/doc/operators.qbk +++ b/doc/operators.qbk @@ -261,7 +261,23 @@ namespace has_unary_minus_impl { template T &make(); -// 2. checks if the operator returns void or not +// 2. we provide our operator definition for types that do not have one already + +// a type returned from operator- when no such operator is +// found in the type's own namespace (our own operator is used) so that we have +// a means to know that our operator was used +struct no_operator { }; + +// this class allows implicit conversions and makes the following operator +// definition less-preferred than any other such operators that might be found +// via argument-dependent name lookup +struct any { template any(T const&); }; + +// when operator- is not available, this one is used +no_operator operator-(const any&); + + +// 3. checks if the operator returns void or not // conditions: Rhs!=void // we first redefine "operator," so that we have no compilation error if @@ -286,7 +302,7 @@ struct operator_returns_void { }; -// 3. checks if the return type is Ret or Ret==dont_care +// 4. checks if the return type is Ret or Ret==dont_care // conditions: Rhs!=void struct dont_care { }; @@ -331,22 +347,6 @@ struct operator_returns_Ret < Rhs, Ret, false > { }; -// 4. we provide our operator definition for types that do not have one already - -// a type returned from operator- when no such operator is -// found in the type's own namespace (our own operator is used) so that we have -// a means to know that our operator was used -struct no_operator { }; - -// this class allows implicit conversions and makes the following operator -// definition less-preferred than any other such operators that might be found -// via argument-dependent name lookup -struct any { template any(T const&); }; - -// when operator- is not available, this one is used -no_operator operator-(const any&); - - // 5. checks for operator existence // condition: Rhs!=void @@ -365,7 +365,7 @@ struct operator_exists { }; -// 5. main trait: to avoid any compilation error, this class behaves +// 6. main trait: to avoid any compilation error, this class behaves // differently when operator-(Rhs) is forbidden by the standard. // Forbidden_if is a bool that is: // - true when the operator-(Rhs) is forbidden by the standard diff --git a/include/boost/type_traits/detail/has_binary_operator.hpp b/include/boost/type_traits/detail/has_binary_operator.hpp index 8984a70..9257bc2 100644 --- a/include/boost/type_traits/detail/has_binary_operator.hpp +++ b/include/boost/type_traits/detail/has_binary_operator.hpp @@ -38,7 +38,7 @@ // cannot find another implementation -> declared as system header to suppress these warnings. #if defined(__GNUC__) && ((__GNUC__==3 && __GNUC_MINOR__>=1) || (__GNUC__>3)) # pragma GCC system_header -#elif BOOST_MSVC +#elif defined(BOOST_MSVC) # pragma warning ( push ) # pragma warning ( disable : 4018 4244 4547 4800 4804 4805 4913 ) #endif @@ -54,7 +54,23 @@ namespace BOOST_JOIN(BOOST_TT_TRAIT_NAME,_impl) { template T &make(); -// 2. checks if the operator returns void or not +// 2. we provide our operator definition for types that do not have one already + +// a type returned from operator BOOST_TT_TRAIT_OP when no such operator is +// found in the type's own namespace (our own operator is used) so that we have +// a means to know that our operator was used +struct no_operator { }; + +// this class allows implicit conversions and makes the following operator +// definition less-preferred than any other such operators that might be found +// via argument-dependent name lookup +struct any { template any(T const&); }; + +// when operator BOOST_TT_TRAIT_OP is not available, this one is used +no_operator operator BOOST_TT_TRAIT_OP (const any&, const any&); + + +// 3. checks if the operator returns void or not // conditions: Lhs!=void and Rhs!=void // we first redefine "operator," so that we have no compilation error if @@ -80,7 +96,7 @@ struct operator_returns_void { }; -// 3. checks if the return type is Ret or Ret==dont_care +// 4. checks if the return type is Ret or Ret==dont_care // conditions: Lhs!=void and Rhs!=void struct dont_care { }; @@ -125,22 +141,6 @@ struct operator_returns_Ret < Lhs, Rhs, Ret, false > { }; -// 4. we provide our operator definition for types that do not have one already - -// a type returned from operator BOOST_TT_TRAIT_OP when no such operator is -// found in the type's own namespace (our own operator is used) so that we have -// a means to know that our operator was used -struct no_operator { }; - -// this class allows implicit conversions and makes the following operator -// definition less-preferred than any other such operators that might be found -// via argument-dependent name lookup -struct any { template any(T const&); }; - -// when operator BOOST_TT_TRAIT_OP is not available, this one is used -no_operator operator BOOST_TT_TRAIT_OP (const any&, const any&); - - // 5. checks for operator existence // condition: Lhs!=void and Rhs!=void @@ -159,7 +159,7 @@ struct operator_exists { }; -// 5. main trait: to avoid any compilation error, this class behaves +// 6. main trait: to avoid any compilation error, this class behaves // differently when operator BOOST_TT_TRAIT_OP(Lhs, Rhs) is forbidden by the // standard. // Forbidden_if is a bool that is: @@ -222,7 +222,7 @@ BOOST_TT_AUX_BOOL_TRAIT_DEF3(BOOST_TT_TRAIT_NAME, Lhs, Rhs=Lhs, Ret=::boost::det } // namespace boost -#ifdef BOOST_MSVC +#if defined(BOOST_MSVC) # pragma warning ( pop ) #endif diff --git a/include/boost/type_traits/detail/has_postfix_operator.hpp b/include/boost/type_traits/detail/has_postfix_operator.hpp index 79fdaf9..5c52b07 100644 --- a/include/boost/type_traits/detail/has_postfix_operator.hpp +++ b/include/boost/type_traits/detail/has_postfix_operator.hpp @@ -21,9 +21,12 @@ // should be the last #include #include -#if defined(BOOST_MSVC) +// avoid warnings +#if defined(__GNUC__) && ((__GNUC__==3 && __GNUC_MINOR__>=1) || (__GNUC__>3)) +# pragma GCC system_header +#elif defined(BOOST_MSVC) # pragma warning ( push ) -# pragma warning ( disable : 4913 4244 ) +# pragma warning ( disable : 4244 4913 ) #endif namespace boost { @@ -37,7 +40,23 @@ namespace BOOST_JOIN(BOOST_TT_TRAIT_NAME,_impl) { template T &make(); -// 2. checks if the operator returns void or not +// 2. we provide our operator definition for types that do not have one already + +// a type returned from operator BOOST_TT_TRAIT_OP when no such operator is +// found in the type's own namespace (our own operator is used) so that we have +// a means to know that our operator was used +struct no_operator { }; + +// this class allows implicit conversions and makes the following operator +// definition less-preferred than any other such operators that might be found +// via argument-dependent name lookup +struct any { template any(T const&); }; + +// when operator BOOST_TT_TRAIT_OP is not available, this one is used +no_operator operator BOOST_TT_TRAIT_OP (const any&, int); + + +// 3. checks if the operator returns void or not // conditions: Lhs!=void // we first redefine "operator," so that we have no compilation error if @@ -60,11 +79,10 @@ struct operator_returns_void { static ::boost::type_traits::yes_type returns_void(returns_void_t); static ::boost::type_traits::no_type returns_void(int); BOOST_STATIC_CONSTANT(bool, value = (sizeof(::boost::type_traits::yes_type)==sizeof(returns_void((make() BOOST_TT_TRAIT_OP,returns_void_t()))))); - //BOOST_STATIC_CONSTANT(bool, value = (::boost::is_same< bool volatile, Lhs >::value)); }; -// 3. checks if the return type is Ret or Ret==dont_care +// 4. checks if the return type is Ret or Ret==dont_care // conditions: Lhs!=void struct dont_care { }; @@ -109,22 +127,6 @@ struct operator_returns_Ret < Lhs, Ret, false > { }; -// 4. we provide our operator definition for types that do not have one already - -// a type returned from operator BOOST_TT_TRAIT_OP when no such operator is -// found in the type's own namespace (our own operator is used) so that we have -// a means to know that our operator was used -struct no_operator { }; - -// this class allows implicit conversions and makes the following operator -// definition less-preferred than any other such operators that might be found -// via argument-dependent name lookup -struct any { template any(T const&); }; - -// when operator BOOST_TT_TRAIT_OP is not available, this one is used -no_operator operator BOOST_TT_TRAIT_OP (const any&, int); - - // 5. checks for operator existence // condition: Lhs!=void @@ -143,7 +145,7 @@ struct operator_exists { }; -// 5. main trait: to avoid any compilation error, this class behaves +// 6. main trait: to avoid any compilation error, this class behaves // differently when operator BOOST_TT_TRAIT_OP(Lhs) is forbidden by the // standard. // Forbidden_if is a bool that is: @@ -194,7 +196,7 @@ BOOST_TT_AUX_BOOL_TRAIT_DEF2(BOOST_TT_TRAIT_NAME, Lhs, Ret=::boost::detail::BOOS } // namespace boost #if defined(BOOST_MSVC) -# pragma warning (pop) +# pragma warning ( pop ) #endif #include diff --git a/include/boost/type_traits/detail/has_prefix_operator.hpp b/include/boost/type_traits/detail/has_prefix_operator.hpp index bdea27e..ac30e4d 100644 --- a/include/boost/type_traits/detail/has_prefix_operator.hpp +++ b/include/boost/type_traits/detail/has_prefix_operator.hpp @@ -32,7 +32,7 @@ // cannot find another implementation -> declared as system header to suppress these warnings. #if defined(__GNUC__) && ((__GNUC__==3 && __GNUC_MINOR__>=1) || (__GNUC__>3)) # pragma GCC system_header -#elif BOOST_MSVC +#elif defined(BOOST_MSVC) # pragma warning ( push ) # pragma warning ( disable : 4146 4804 4913 4244 ) #endif @@ -48,7 +48,23 @@ namespace BOOST_JOIN(BOOST_TT_TRAIT_NAME,_impl) { template T &make(); -// 2. checks if the operator returns void or not +// 2. we provide our operator definition for types that do not have one already + +// a type returned from operator BOOST_TT_TRAIT_OP when no such operator is +// found in the type's own namespace (our own operator is used) so that we have +// a means to know that our operator was used +struct no_operator { }; + +// this class allows implicit conversions and makes the following operator +// definition less-preferred than any other such operators that might be found +// via argument-dependent name lookup +struct any { template any(T const&); }; + +// when operator BOOST_TT_TRAIT_OP is not available, this one is used +no_operator operator BOOST_TT_TRAIT_OP (const any&); + + +// 3. checks if the operator returns void or not // conditions: Rhs!=void // we first redefine "operator," so that we have no compilation error if @@ -74,7 +90,7 @@ struct operator_returns_void { }; -// 3. checks if the return type is Ret or Ret==dont_care +// 4. checks if the return type is Ret or Ret==dont_care // conditions: Rhs!=void struct dont_care { }; @@ -119,22 +135,6 @@ struct operator_returns_Ret < Rhs, Ret, false > { }; -// 4. we provide our operator definition for types that do not have one already - -// a type returned from operator BOOST_TT_TRAIT_OP when no such operator is -// found in the type's own namespace (our own operator is used) so that we have -// a means to know that our operator was used -struct no_operator { }; - -// this class allows implicit conversions and makes the following operator -// definition less-preferred than any other such operators that might be found -// via argument-dependent name lookup -struct any { template any(T const&); }; - -// when operator BOOST_TT_TRAIT_OP is not available, this one is used -no_operator operator BOOST_TT_TRAIT_OP (const any&); - - // 5. checks for operator existence // condition: Rhs!=void @@ -153,7 +153,7 @@ struct operator_exists { }; -// 5. main trait: to avoid any compilation error, this class behaves +// 6. main trait: to avoid any compilation error, this class behaves // differently when operator BOOST_TT_TRAIT_OP(Rhs) is forbidden by the // standard. // Forbidden_if is a bool that is: @@ -203,7 +203,7 @@ BOOST_TT_AUX_BOOL_TRAIT_DEF2(BOOST_TT_TRAIT_NAME, Rhs, Ret=::boost::detail::BOOS } // namespace boost -#ifdef BOOST_MSVC +#if defined(BOOST_MSVC) # pragma warning ( pop ) #endif