Subject: Re: [boost] How to detect if f() returns void or not?
From: Andy Venikov (avenikov_at_[hidden])
Date: 2009-12-15 13:47:06
Eric Niebler wrote:
> FrÃ©dÃ©ric Bron wrote:
>> I would like to detect if the return type of a function is void or not
>> within C++03 standard?
> I solved this problem once while writing a different trait and
> documented it here:
I gotta admit, this thing is amazing. I actually needed to implement a
way to tell whether a type is an io manipulator (basically telling if
calling T(ostream) is a well-formed expression), and was at a loss. I
was about to post a question on comp.lang.c++ but suddenly came across
this thread and your solution fit like hand in glove.
I do have a question though.
In your "fununwrap2" class you define the typedef as
typedef private_type const &(*pointer_to_function)
and dont_care constructor has ellipsis instead of an argument list.
Why use dont_care at all? Why not define the pointer_to_function type as:
typedef private_type (*pointer_to_function)
It seems to be working just as good.
Or am I missing something?