Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r80654 - in trunk/boost/utility: . detail
From: eric_at_[hidden]
Date: 2012-09-22 21:11:01


Author: eric_niebler
Date: 2012-09-22 21:11:00 EDT (Sat, 22 Sep 2012)
New Revision: 80654
URL: http://svn.boost.org/trac/boost/changeset/80654

Log:
gcc-4.4 doesn't have robust enough support for sfinae-for-expressions
Text files modified:
   trunk/boost/utility/detail/result_of_iterate.hpp | 24 ++++++++--------
   trunk/boost/utility/result_of.hpp | 54 +++++++++++++++++++++------------------
   2 files changed, 41 insertions(+), 37 deletions(-)

Modified: trunk/boost/utility/detail/result_of_iterate.hpp
==============================================================================
--- trunk/boost/utility/detail/result_of_iterate.hpp (original)
+++ trunk/boost/utility/detail/result_of_iterate.hpp 2012-09-22 21:11:00 EDT (Sat, 22 Sep 2012)
@@ -56,37 +56,37 @@
 
 namespace detail {
 
-#ifdef BOOST_NO_SFINAE_EXPR
+#ifdef BOOST_RESULT_OF_NO_SFINAE_EXPR
 
 template<typename F>
-struct BOOST_PP_CAT(result_of_is_callable_fun_2_, BOOST_PP_ITERATION());
+struct BOOST_PP_CAT(result_of_callable_fun_2_, BOOST_PP_ITERATION());
 
 template<typename R BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_PP_ITERATION(), typename T)>
-struct BOOST_PP_CAT(result_of_is_callable_fun_2_, BOOST_PP_ITERATION())<R(BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(), T))> {
+struct BOOST_PP_CAT(result_of_callable_fun_2_, BOOST_PP_ITERATION())<R(BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(), T))> {
     R operator()(BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(), T)) const;
     typedef result_of_private_type const &(*pfn_t)(...);
     operator pfn_t() const volatile;
 };
 
 template<typename F>
-struct BOOST_PP_CAT(result_of_is_callable_fun_, BOOST_PP_ITERATION());
+struct BOOST_PP_CAT(result_of_callable_fun_, BOOST_PP_ITERATION());
 
 template<typename F>
-struct BOOST_PP_CAT(result_of_is_callable_fun_, BOOST_PP_ITERATION())<F *>
- : BOOST_PP_CAT(result_of_is_callable_fun_2_, BOOST_PP_ITERATION())<F>
+struct BOOST_PP_CAT(result_of_callable_fun_, BOOST_PP_ITERATION())<F *>
+ : BOOST_PP_CAT(result_of_callable_fun_2_, BOOST_PP_ITERATION())<F>
 {};
 
 template<typename F>
-struct BOOST_PP_CAT(result_of_is_callable_fun_, BOOST_PP_ITERATION())<F &>
- : BOOST_PP_CAT(result_of_is_callable_fun_2_, BOOST_PP_ITERATION())<F>
+struct BOOST_PP_CAT(result_of_callable_fun_, BOOST_PP_ITERATION())<F &>
+ : BOOST_PP_CAT(result_of_callable_fun_2_, BOOST_PP_ITERATION())<F>
 {};
 
 template<typename F>
 struct BOOST_PP_CAT(result_of_select_call_wrapper_type_, BOOST_PP_ITERATION())
   : mpl::eval_if<
         is_class<typename remove_reference<F>::type>,
- result_of_wrap_callable<result_of_callable_class, F>,
- mpl::identity<BOOST_PP_CAT(result_of_is_callable_fun_, BOOST_PP_ITERATION())<typename remove_cv<F>::type> >
+ result_of_wrap_callable_class<F>,
+ mpl::identity<BOOST_PP_CAT(result_of_callable_fun_, BOOST_PP_ITERATION())<typename remove_cv<F>::type> >
>
 {};
 
@@ -119,7 +119,7 @@
   ) type;
 };
 
-#else // BOOST_NO_SFINAE_EXPR
+#else // BOOST_RESULT_OF_NO_SFINAE_EXPR
 
 template<typename F BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_PP_ITERATION(),typename T)>
 struct cpp0x_result_of_impl<F(BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(),T)),
@@ -135,7 +135,7 @@
   ) type;
 };
 
-#endif // BOOST_NO_SFINAE_EXPR
+#endif // BOOST_RESULT_OF_NO_SFINAE_EXPR
 
 } // namespace detail
 

Modified: trunk/boost/utility/result_of.hpp
==============================================================================
--- trunk/boost/utility/result_of.hpp (original)
+++ trunk/boost/utility/result_of.hpp 2012-09-22 21:11:00 EDT (Sat, 22 Sep 2012)
@@ -54,6 +54,10 @@
 # endif
 #endif
 
+#if defined(BOOST_NO_SFINAE_EXPR) || (BOOST_WORKAROUND(__GNUC__, == 4) && __GNUC_MINOR__ < 5)
+# define BOOST_RESULT_OF_NO_SFINAE_EXPR
+#endif
+
 namespace boost {
 
 template<typename F> struct result_of;
@@ -66,7 +70,7 @@
 
 template<typename F, typename FArgs, bool HasResultType> struct tr1_result_of_impl;
 
-#ifdef BOOST_NO_SFINAE_EXPR
+#ifdef BOOST_RESULT_OF_NO_SFINAE_EXPR
 
 template<typename T> T result_of_decay(T);
 
@@ -75,13 +79,6 @@
   result_of_private_type const &operator,(int) const;
 };
 
-template<typename C>
-struct result_of_callable_class : C {
- result_of_callable_class();
- typedef result_of_private_type const &(*pfn_t)(...);
- operator pfn_t() const volatile;
-};
-
 typedef char result_of_yes_type; // sizeof(result_of_yes_type) == 1
 typedef char (&result_of_no_type)[2]; // sizeof(result_of_no_type) == 2
 
@@ -90,34 +87,41 @@
 
 result_of_yes_type result_of_is_private_type(result_of_private_type const &);
 
-template<template<typename> class Wrapper, typename C>
-struct result_of_wrap_callable {
- typedef Wrapper<C> type;
+template<typename C>
+struct result_of_callable_class : C {
+ result_of_callable_class();
+ typedef result_of_private_type const &(*pfn_t)(...);
+ operator pfn_t() const volatile;
+};
+
+template<typename C>
+struct result_of_wrap_callable_class {
+ typedef result_of_callable_class<C> type;
 };
 
-template<template<typename> class Wrapper, typename C>
-struct result_of_wrap_callable<Wrapper, C &> {
- typedef typename result_of_wrap_callable<Wrapper, C>::type &type;
+template<typename C>
+struct result_of_wrap_callable_class<C const> {
+ typedef result_of_callable_class<C> const type;
 };
 
-template<template<typename> class Wrapper, typename C>
-struct result_of_wrap_callable<Wrapper, C const> {
- typedef typename result_of_wrap_callable<Wrapper, C>::type const type;
+template<typename C>
+struct result_of_wrap_callable_class<C volatile> {
+ typedef result_of_callable_class<C> volatile type;
 };
 
-template<template<typename> class Wrapper, typename C>
-struct result_of_wrap_callable<Wrapper, C volatile> {
- typedef typename result_of_wrap_callable<Wrapper, C>::type volatile type;
+template<typename C>
+struct result_of_wrap_callable_class<C const volatile> {
+ typedef result_of_callable_class<C> const volatile type;
 };
 
-template<template<typename> class Wrapper, typename C>
-struct result_of_wrap_callable<Wrapper, C const volatile> {
- typedef typename result_of_wrap_callable<Wrapper, C>::type const volatile type;
+template<typename C>
+struct result_of_wrap_callable_class<C &> {
+ typedef typename result_of_wrap_callable_class<C>::type &type;
 };
 
 template<typename F, bool TestCallability = true> struct cpp0x_result_of_impl;
 
-#else // BOOST_NO_SFINAE_EXPR
+#else // BOOST_RESULT_OF_NO_SFINAE_EXPR
 
 template<typename T>
 struct result_of_always_void
@@ -127,7 +131,7 @@
 
 template<typename F, typename Enable = void> struct cpp0x_result_of_impl {};
 
-#endif // BOOST_NO_SFINAE_EXPR
+#endif // BOOST_RESULT_OF_NO_SFINAE_EXPR
 
 template<typename F>
 struct result_of_void_impl


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