Boost logo

Boost :

Subject: [boost] [bind] Request: use result_of instead of result_type for functors
From: Jason (jasonr_at_[hidden])
Date: 2013-02-05 11:57:43


One of the drawbacks of using functors with Boost.Bind is that the result
type of the functor must be specified either as a typedef inside the
functor's definition or as a template argument when building the binding. As
the documentation states it:

    "In the general case, the return type of the generated function object's
operator() has to be specified explicitly
    (without a typeof operator the return type cannot be inferred)"

It seems that result_of() would be a good implementation of the "typeof"
operator referenced in the above, instead of relying upon a single
result_type typedef inside the functor struct/class. This would allow the
use of functors whose result type depends upon the arguments passed to the
functor. It looks like there was a proof-of-concept patch submitted for this
a couple years ago:

    https://svn.boost.org/trac/boost/ticket/4542

It doesn't appear to have received any attention, however. Is this something
that might happen?

--
View this message in context: http://boost.2283326.n4.nabble.com/bind-Request-use-result-of-instead-of-result-type-for-functors-tp4642311.html
Sent from the Boost - Dev mailing list archive at Nabble.com.

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk