Boost logo

Boost :

Subject: Re: [boost] How to detect if f() returns void or not?
From: Eric Niebler (eric_at_[hidden])
Date: 2009-12-20 17:36:45


On 12/20/2009 9:10 PM, joel falcou wrote:
> Eric Niebler wrote:
>> The only solution would be to modify the bind function object so that
>> its operator() refused to accept arguments that its bound function
>> doesn't also accept. This can be done with SFINAE using something akin
>> to can_be_called. I'm not suggesting that such a change be made to
>> Boost.Bind, but it would have one advantage: if users try to pass
>> unacceptable arguments, the resulting error would point to the
>> offending line in *their* code rather than someplace deep in Boost.Bind.
>
> Can can_be_called become a first class Boost citizen in type_traits or
> some such ? Sounds like there is a substantial number of use cases in
> which it may help.
>

Are you volunteering? :-) Might be a good addition to Function_traits. I
imagine an interface like:

   can_be_called< Fun(Arg0, Arg1) >

Or maybe callable, or can_be_invoked, or invokable, or
callable_with_args, or ... callable_with_args ain't so bad. Yes, I think
this would be a good addition.

-- 
Eric Niebler
BoostPro Computing
http://www.boostpro.com

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