Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r77820 - in trunk: boost/local_function/aux_/macro/code_ libs/functional/overloaded_function/test libs/local_function/test
From: lorcaminiti_at_[hidden]
Date: 2012-04-07 14:45:14


Author: lcaminiti
Date: 2012-04-07 14:45:13 EDT (Sat, 07 Apr 2012)
New Revision: 77820
URL: http://svn.boost.org/trac/boost/changeset/77820

Log:
Wrapped a metafunction call into a local struct to try to workaround a problem with add_template on the intel compiler.
Text files modified:
   trunk/boost/local_function/aux_/macro/code_/functor.hpp | 18 +++++++------
   trunk/boost/local_function/aux_/macro/code_/result.hpp | 51 ++++++++++++++++++++-------------------
   trunk/libs/functional/overloaded_function/test/identity.hpp | 3 +
   trunk/libs/local_function/test/return_derivative.cpp | 1
   trunk/libs/local_function/test/return_derivative_seq.cpp | 1
   5 files changed, 40 insertions(+), 34 deletions(-)

Modified: trunk/boost/local_function/aux_/macro/code_/functor.hpp
==============================================================================
--- trunk/boost/local_function/aux_/macro/code_/functor.hpp (original)
+++ trunk/boost/local_function/aux_/macro/code_/functor.hpp 2012-04-07 14:45:13 EDT (Sat, 07 Apr 2012)
@@ -325,8 +325,8 @@
 
 // Expand to the function type `R (A1, ...)`.
 #define BOOST_LOCAL_FUNCTION_AUX_CODE_FUNCTOR_F_( \
- id, decl_traits, has_type, function_type) \
- BOOST_LOCAL_FUNCTION_AUX_CODE_RESULT_TYPE(id) \
+ id, typename01, decl_traits, has_type, function_type) \
+ BOOST_LOCAL_FUNCTION_AUX_CODE_RESULT_TYPE(id, typename01) \
     BOOST_PP_EXPR_IIF(has_type, (function_type) ) \
     ( \
         BOOST_PP_LIST_FOR_EACH_I( \
@@ -385,7 +385,8 @@
 #define BOOST_LOCAL_FUNCTION_AUX_CODE_FUNCTOR_CALL_(z, defaults_n, \
         id, typename01, decl_traits, params, \
         const_binds, has_const_bind_this, binds, has_bind_this) \
- inline BOOST_LOCAL_FUNCTION_AUX_CODE_RESULT_TYPE(id) operator()( \
+ inline BOOST_LOCAL_FUNCTION_AUX_CODE_RESULT_TYPE(id, typename01) \
+ operator()( \
         BOOST_PP_LIST_FOR_EACH_I( \
                 BOOST_LOCAL_FUNCTION_AUX_CODE_FUNCTOR_PARAM_ARG_DECL_ENUM_, \
                 typename01, params) \
@@ -461,7 +462,7 @@
 #define BOOST_LOCAL_FUNCTION_AUX_CODE_FUNCTOR_STATIC_CALL_(z, defaults_n, \
         id, typename01, decl_traits, params, \
         const_binds, has_const_bind_this, binds, has_bind_this) \
- inline static BOOST_LOCAL_FUNCTION_AUX_CODE_RESULT_TYPE(id) \
+ inline static BOOST_LOCAL_FUNCTION_AUX_CODE_RESULT_TYPE(id, typename01) \
     BOOST_LOCAL_FUNCTION_AUX_CODE_FUNCTOR_STATIC_CALL_FUNC_(z, defaults_n, ~)( \
         void* object \
         BOOST_PP_IIF(BOOST_LOCAL_FUNCTION_CONFIG_LOCALS_AS_TPARAMS, \
@@ -691,8 +692,8 @@
     { \
         /* function type */ \
         typedef \
- BOOST_LOCAL_FUNCTION_AUX_CODE_FUNCTOR_F_(id, decl_traits, \
- 1 /* has type */, \
+ BOOST_LOCAL_FUNCTION_AUX_CODE_FUNCTOR_F_(id, typename01, \
+ decl_traits, 1 /* has type */, \
                     BOOST_LOCAL_FUNCTION_AUX_CODE_FUNCTOR_F_TYPE_) \
         ; \
         /* functor type -- this type cannot have ID postfix because it is */ \
@@ -721,7 +722,8 @@
         /* (traits must be defined in both this and the global functor) */ \
         enum { arity = ::boost::function_traits< /* can't use static data */ \
                 BOOST_LOCAL_FUNCTION_AUX_CODE_FUNCTOR_F_TYPE_ >::arity }; \
- typedef BOOST_LOCAL_FUNCTION_AUX_CODE_RESULT_TYPE(id) result_type; \
+ typedef BOOST_LOCAL_FUNCTION_AUX_CODE_RESULT_TYPE(id, typename01) \
+ result_type; \
         BOOST_PP_LIST_FOR_EACH_I( \
                 BOOST_LOCAL_FUNCTION_AUX_CODE_FUNCTOR_ARG_TYPEDEF_, \
                 typename01, params) \
@@ -791,7 +793,7 @@
         /* body function (unfortunately, cannot be static to allow access */ \
         /* to member var with local function name for recursion but doing */ \
         /* so also allows the body to misuse `this` instead of `this_`) */ \
- inline BOOST_LOCAL_FUNCTION_AUX_CODE_RESULT_TYPE(id) \
+ inline BOOST_LOCAL_FUNCTION_AUX_CODE_RESULT_TYPE(id, typename01) \
         BOOST_LOCAL_FUNCTION_AUX_CODE_FUNCTOR_BODY_FUNC_( \
                 /* const binds */ \
                 BOOST_PP_LIST_FOR_EACH_I( \

Modified: trunk/boost/local_function/aux_/macro/code_/result.hpp
==============================================================================
--- trunk/boost/local_function/aux_/macro/code_/result.hpp (original)
+++ trunk/boost/local_function/aux_/macro/code_/result.hpp 2012-04-07 14:45:13 EDT (Sat, 07 Apr 2012)
@@ -39,8 +39,8 @@
 #define BOOST_LOCAL_FUNCTION_AUX_CODE_RESULT_PARAMS_(id) \
     BOOST_LOCAL_FUNCTION_AUX_SYMBOL( (deduce_result_params)(id) )
 
-#define BOOST_LOCAL_FUNCTION_AUX_CODE_RESULT_FUNC_TYPE_(id) \
- BOOST_LOCAL_FUNCTION_AUX_SYMBOL( (deduce_result_function_type)(id) )
+#define BOOST_LOCAL_FUNCTION_AUX_CODE_RESULT_TYPE_(id) \
+ BOOST_LOCAL_FUNCTION_AUX_SYMBOL( (result_type)(id) )
 
 // User did not explicitly specified result type, deduce it (using Typeof).
 #define BOOST_LOCAL_FUNCTION_AUX_CODE_RESULT_DEDUCE_( \
@@ -70,37 +70,38 @@
         BOOST_LOCAL_FUNCTION_AUX_CODE_RESULT_CAPTURE_(id) \
     ; \
     struct BOOST_LOCAL_FUNCTION_AUX_CODE_RESULT_PARAMS_(id) { \
- /* this typedef is internal to struct so its name will not clash */ \
- typedef BOOST_LOCAL_FUNCTION_AUX_CODE_RESULT_CAPTURE_(id) \
- function_ptr; \
- }; \
- typedef BOOST_PP_EXPR_IIF(typename01, typename) \
- ::boost::remove_pointer< BOOST_PP_EXPR_IIF(typename01, typename) \
- BOOST_LOCAL_FUNCTION_AUX_CODE_RESULT_PARAMS_(id)::function_ptr \
- >::type \
- BOOST_LOCAL_FUNCTION_AUX_CODE_RESULT_FUNC_TYPE_(id) \
- ; \
- typedef BOOST_PP_EXPR_IIF(typename01, typename) \
- ::boost::function_traits< \
- BOOST_LOCAL_FUNCTION_AUX_CODE_RESULT_FUNC_TYPE_(id) \
- >::result_type \
- BOOST_LOCAL_FUNCTION_AUX_CODE_RESULT_TYPE(id) \
- ;
+ /* internal to struct to workaround GCC and other compiler's issues */ \
+ typedef \
+ BOOST_PP_EXPR_IIF(typename01, typename) \
+ ::boost::function_traits< \
+ BOOST_PP_EXPR_IIF(typename01, typename) \
+ ::boost::remove_pointer< \
+ BOOST_LOCAL_FUNCTION_AUX_CODE_RESULT_CAPTURE_(id) \
+ >::type \
+ >::result_type \
+ BOOST_LOCAL_FUNCTION_AUX_CODE_RESULT_TYPE_(id) \
+ ; \
+ };
 
 // Use result type as explicitly specified by user (no type deduction needed).
 // Precondition: RETURNS(decl_traits) != NIL
 #define BOOST_LOCAL_FUNCTION_AUX_CODE_RESULT_TYPED_( \
         id, typename01, decl_traits) \
- typedef \
- BOOST_PP_LIST_FIRST(BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_RETURNS( \
- decl_traits)) \
- BOOST_LOCAL_FUNCTION_AUX_CODE_RESULT_TYPE(id) \
- ;
+ struct BOOST_LOCAL_FUNCTION_AUX_CODE_RESULT_PARAMS_(id) { \
+ typedef \
+ BOOST_PP_LIST_FIRST( \
+ BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_RETURNS( \
+ decl_traits)) \
+ BOOST_LOCAL_FUNCTION_AUX_CODE_RESULT_TYPE_(id) \
+ ; \
+ };
 
 // PUBLIC //
 
-#define BOOST_LOCAL_FUNCTION_AUX_CODE_RESULT_TYPE(id) \
- BOOST_LOCAL_FUNCTION_AUX_SYMBOL( (result_type)(id) )
+#define BOOST_LOCAL_FUNCTION_AUX_CODE_RESULT_TYPE(id, typename01) \
+ BOOST_PP_EXPR_IIF(typename01, typename) \
+ BOOST_LOCAL_FUNCTION_AUX_CODE_RESULT_PARAMS_(id) :: \
+ BOOST_LOCAL_FUNCTION_AUX_CODE_RESULT_TYPE_(id)
 
 #define BOOST_LOCAL_FUNCTION_AUX_CODE_RESULT_DECL(id) \
     /* result type here */ (*BOOST_LOCAL_FUNCTION_AUX_CODE_RESULT_FUNC_(id))();

Modified: trunk/libs/functional/overloaded_function/test/identity.hpp
==============================================================================
--- trunk/libs/functional/overloaded_function/test/identity.hpp (original)
+++ trunk/libs/functional/overloaded_function/test/identity.hpp 2012-04-07 14:45:13 EDT (Sat, 07 Apr 2012)
@@ -24,7 +24,8 @@
 #include <boost/typeof/typeof.hpp>
 #include <boost/typeof/std/string.hpp>
 #include BOOST_TYPEOF_INCREMENT_REGISTRATION_GROUP()
-BOOST_TYPEOF_REGISTER_TEMPLATE(boost::function1, 2) // Use `functionN`.
+BOOST_TYPEOF_REGISTER_TEMPLATE(boost::function, 1)
+BOOST_TYPEOF_REGISTER_TEMPLATE(boost::function1, 2) // Also `functionN`.
 //]
 
 #endif // #include guard

Modified: trunk/libs/local_function/test/return_derivative.cpp
==============================================================================
--- trunk/libs/local_function/test/return_derivative.cpp (original)
+++ trunk/libs/local_function/test/return_derivative.cpp 2012-04-07 14:45:13 EDT (Sat, 07 Apr 2012)
@@ -17,6 +17,7 @@
 #include <boost/detail/lightweight_test.hpp>
 
 BOOST_TYPEOF_REGISTER_TEMPLATE(boost::function, 1)
+BOOST_TYPEOF_REGISTER_TEMPLATE(boost::function1, 2) // Also `functionN`.
 
 boost::function<int (int)> derivative(boost::function<int (int)>& f, int dx) {
     int BOOST_LOCAL_FUNCTION(bind& f, const bind dx, int x) {

Modified: trunk/libs/local_function/test/return_derivative_seq.cpp
==============================================================================
--- trunk/libs/local_function/test/return_derivative_seq.cpp (original)
+++ trunk/libs/local_function/test/return_derivative_seq.cpp 2012-04-07 14:45:13 EDT (Sat, 07 Apr 2012)
@@ -12,6 +12,7 @@
 #include <boost/detail/lightweight_test.hpp>
 
 BOOST_TYPEOF_REGISTER_TEMPLATE(boost::function, 1)
+BOOST_TYPEOF_REGISTER_TEMPLATE(boost::function1, 2) // Also `functionN`.
 
 boost::function<int (int)> derivative(boost::function<int (int)>& f, int dx) {
     int BOOST_LOCAL_FUNCTION( (bind& f) (const bind dx) (int x) ) {


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