Boost logo

Boost Users :

Subject: [Boost-users] boost::result_of template
From: John M. Dlugosz (mpbecey7gu_at_[hidden])
Date: 2012-04-13 07:22:43


Consider these functions:

     template <typename F>
     unique_future<typename boost::result_of< F() >::type>
     foo (F&& f) { ⋯

     template <typename F, typename A1>
     unique_future<typename boost::result_of< F(A1) >::type>
     foo (F&& f, A1&& a1)
         {
          return foo (std::tr1::bind(f,a1));
         }

I can call foo(&bar,5) to mean the same thing as foo(bind(&bar,5)), OK.
But I cannot call foo(&C::mf, pc) to mean the same as foo(bind(&C::mf,pc)) when the
binding in question is pc->mf().

That is, bind treats a member function automatically as a function whose first argument is
'this', but boost::result_of does not have the same trick.

How can I express the result type of the second form of foo shown above?

—John


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net