Subject: Re: [boost] How to detect if f() returns void or not?
From: Eric Niebler (eric_at_[hidden])
Date: 2009-12-20 19:53:21
On 12/21/2009 11:36 AM, Eric Niebler wrote:
> On 12/20/2009 9:10 PM, joel falcou wrote:
>> 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.
I had some time, so I knocked together a simple implementation and some
test cases. This ignores things like calling convention, but mostly
works. It would need someone to finish it, flesh out the test cases and
I've opened a feature request against the Function_types library and
attached the code as a starting point:
-- 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