From 90b94a956043d8f82b626eb58ced3654a9e2bb37 Mon Sep 17 00:00:00 2001 From: Lorenzo Caminiti Date: Thu, 12 Apr 2012 21:12:28 +0000 Subject: [PATCH] Forcing type-of emulation on Sun. Trying to fix OverloadedFunction pp bug on Sun by removing SUB on iteration range (doing ADD on iteration index instead). [SVN r77940] --- .../boost/functional/overloaded_function.hpp | 17 ++++++++--------- .../overloaded_function/detail/base.hpp | 4 +--- .../detail/function_type.hpp | 2 +- overloaded_function/test/Jamfile.v2 | 3 +++ overloaded_function/test/identity.hpp | 2 +- 5 files changed, 14 insertions(+), 14 deletions(-) diff --git a/include/boost/functional/overloaded_function.hpp b/include/boost/functional/overloaded_function.hpp index 2ed228d..f224c4f 100644 --- a/include/boost/functional/overloaded_function.hpp +++ b/include/boost/functional/overloaded_function.hpp @@ -24,6 +24,7 @@ # include # include # include +# include # include # include # include @@ -82,14 +83,10 @@ BOOST_FUNCTIONAL_f_type(z, n, ~) \ >::type -// Iterate within namespace. -# define BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_OVERLOAD_COUNT \ - /*at least 2 func to overload 2, 3, ...*/ \ - BOOST_PP_SUB( \ - BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_OVERLOAD_MAX, \ - 2) # define BOOST_PP_ITERATION_PARAMS_1 \ - (3, (0, BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_OVERLOAD_COUNT, \ + /* at least 2 func to overload so start from 2 to MAX */ \ + /* (cannot iterate [0, MAX-2) because error on Sun) */ \ + (3, (2, BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_OVERLOAD_MAX, \ "boost/functional/overloaded_function.hpp")) # include BOOST_PP_ITERATE() // Iterate over function arity. @@ -113,8 +110,10 @@ #elif BOOST_PP_ITERATION_DEPTH() == 1 # define BOOST_FUNCTIONAL_overloads \ /* iterate as OVERLOADS, OVERLOADS-1, OVERLOADS-2, ... */ \ - BOOST_PP_SUB(BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_OVERLOAD_MAX, \ - BOOST_PP_FRAME_ITERATION(1)) + /* (add 2 because iteration started from 2 to MAX) */ \ + BOOST_PP_ADD(2, BOOST_PP_SUB( \ + BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_OVERLOAD_MAX, \ + BOOST_PP_FRAME_ITERATION(1))) # define BOOST_FUNCTIONAL_is_tspec \ /* if template specialization */ \ BOOST_PP_LESS(BOOST_FUNCTIONAL_overloads, \ diff --git a/include/boost/functional/overloaded_function/detail/base.hpp b/include/boost/functional/overloaded_function/detail/base.hpp index 38083ed..8fd9a0a 100644 --- a/include/boost/functional/overloaded_function/detail/base.hpp +++ b/include/boost/functional/overloaded_function/detail/base.hpp @@ -10,7 +10,7 @@ # define BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_DETAIL_BASE_HPP_ # include -/**@todo# include */ +# include # include # include # include @@ -39,12 +39,10 @@ namespace boost { namespace overloaded_function_detail { template class base {}; // Empty template cannot be used directly (only its spec). -/*@todo # define BOOST_PP_ITERATION_PARAMS_1 \ (3, (0, BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_ARITY_MAX, \ "boost/functional/overloaded_function/detail/base.hpp")) # include BOOST_PP_ITERATE() // Iterate over funciton arity. -*/ } } // namespace diff --git a/include/boost/functional/overloaded_function/detail/function_type.hpp b/include/boost/functional/overloaded_function/detail/function_type.hpp index 58bf09c..0c28607 100644 --- a/include/boost/functional/overloaded_function/detail/function_type.hpp +++ b/include/boost/functional/overloaded_function/detail/function_type.hpp @@ -16,7 +16,7 @@ #include #include #include -/** @todo #include */ +#include #include #include #include diff --git a/overloaded_function/test/Jamfile.v2 b/overloaded_function/test/Jamfile.v2 index 160130d..f4fab4c 100644 --- a/overloaded_function/test/Jamfile.v2 +++ b/overloaded_function/test/Jamfile.v2 @@ -7,6 +7,9 @@ import testing ; +# Sun does not automatically detect type-of emulation (force it). +project : requirements sun:BOOST_TYPEOF_EMULATION ; + run functor.cpp ; run make_decl.cpp ; run make_call.cpp ; diff --git a/overloaded_function/test/identity.hpp b/overloaded_function/test/identity.hpp index 9b64da7..5134429 100644 --- a/overloaded_function/test/identity.hpp +++ b/overloaded_function/test/identity.hpp @@ -8,10 +8,10 @@ #ifndef IDENTITY_HPP_ #define IDENTITY_HPP_ -/** @todo #include */ //[identity_typeof #include // No need to register `boost::function`. //] +#include #include //[identity_decls