Re: [Boost-bugs] [Boost C++ Libraries] #7343: Extend result_of to work with SFINAE

Subject: Re: [Boost-bugs] [Boost C++ Libraries] #7343: Extend result_of to work with SFINAE
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2012-09-19 17:33:45


#7343: Extend result_of to work with SFINAE
-------------------------------+--------------------------------------------
  Reporter: djwalker | Owner: djwalker
      Type: Feature Requests | Status: new
 Milestone: To Be Determined | Component: utility
   Version: Boost 1.52.0 | Severity: Problem
Resolution: | Keywords: result_of, decltype, SFINAE
-------------------------------+--------------------------------------------

Comment (by eric_niebler):

 Daniel, I've attached a much simpler, lighter-weight patch. However, both
 of our patches are incomplete because of how `result_of` is defined:

 {{{
 // Uses declval following N3225 20.7.7.6 when F is not a pointer.
 template<typename F BOOST_PP_COMMA_IF(BOOST_PP_ITERATION())
          BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(),typename T)>
 struct result_of<F(BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(),T))>
     : mpl::if_<
           is_member_function_pointer<F>
         , detail::tr1_result_of_impl<
             typename remove_cv<F>::type,
             typename
 remove_cv<F>::type(BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(),T)), false
>
         , detail::cpp0x_result_of_impl<
               F(BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(),T))
>
>::type
 {};
 }}}

 If `F` is a member function pointer, the first branch of the `mpl::if_`
 gets taken, and no clever SFINAE guards `detail::tr1_result_of_impl`.

 But to a first approximation, I think this is good enough for 1.52. I
 tested my patch with clang-trunk, but not the most recent stable release,
 and not with msvc-11, which I'm downloading now. If you have access to
 those and want to get a jump on things, that'd be great. I'd like to get
 this change in to trunk ASAP so we have time to merge to release for 1.52.

 Thanks for your work on this.

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/7343#comment:1>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:10 UTC