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:

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

View this message in context:
Sent from the Boost - Dev mailing list archive at

Boost list run by bdawes at, gregod at, cpdaniel at, john at