Ticket #5098: result_of.patch

File result_of.patch, 2.0 KB (added by mimomorin@…, 12 years ago)

A patch against trunk (boost/utility/result_of.hpp, boost/utility/detail/result_of_iterate.hpp)

  • boost/utility/detail/result_of_iterate.hpp

     
    5656
    5757namespace detail {
    5858
    59 # define BOOST_RESULT_OF_STATIC_MEMBERS(z, n, _) \
    60      static T ## n t ## n; \
    61   /**/
    62 
    6359template<typename F BOOST_PP_COMMA_IF(BOOST_PP_ITERATION())
    6460         BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(),typename T)>
    6561class cpp0x_result_of_impl<F(BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(),T))>
    6662{
    67   static F f;
    68   BOOST_PP_REPEAT(BOOST_PP_ITERATION(), BOOST_RESULT_OF_STATIC_MEMBERS, _)
     63  template<typename S>
     64  static typename add_rvalue_reference<S>::type declval();
    6965public:
    70   typedef decltype(f(BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(),t))) type;
     66  typedef decltype(
     67    declval<F>()(
     68      BOOST_PP_ENUM_BINARY_PARAMS(BOOST_PP_ITERATION(), declval<T, >() BOOST_PP_INTERCEPT)
     69    )
     70  ) type;
    7171};
    7272
    7373} // namespace detail
  • boost/utility/result_of.hpp

     
    1313#include <boost/preprocessor/iteration/iterate.hpp>
    1414#include <boost/preprocessor/punctuation/comma_if.hpp>
    1515#include <boost/preprocessor/repetition/enum_params.hpp>
     16#include <boost/preprocessor/repetition/enum_binary_params.hpp>
    1617#include <boost/preprocessor/repetition/enum_shifted_params.hpp>
     18#include <boost/preprocessor/facilities/intercept.hpp>
    1719#include <boost/detail/workaround.hpp>
    1820#include <boost/mpl/has_xxx.hpp>
    1921#include <boost/mpl/if.hpp>
     
    2224#include <boost/type_traits/is_pointer.hpp>
    2325#include <boost/type_traits/is_member_function_pointer.hpp>
    2426#include <boost/type_traits/remove_cv.hpp>
     27#include <boost/type_traits/add_rvalue_reference.hpp>
    2528
    2629#ifndef BOOST_RESULT_OF_NUM_ARGS
    2730#  define BOOST_RESULT_OF_NUM_ARGS 10