Boost logo

Boost :

Subject: Re: [boost] [bind] Request: use result_of instead of result_type for functors
From: Jeffrey Lee Hellrung, Jr. (jeffrey.hellrung_at_[hidden])
Date: 2013-02-05 20:21:16


On Tue, Feb 5, 2013 at 8:57 AM, Jason <jasonr_at_[hidden]> wrote:

> 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?
>

My guess: probably not, given that Boost.Bind has been largely superseded
by Boost.Phoenix.Bind.

- Jeff


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