Subject: Re: [boost] How to detect if f() returns void or not?
From: Eric Niebler (eric_at_[hidden])
Date: 2009-12-15 01:56:18
Edward Diener wrote:
> David Abrahams wrote:
>> On Dec 14, 2009, at 8:40 PM, Edward Diener wrote:
>>> 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:
>>> It's extremely clever, as others have noted, but I am wondering if
>>> there is any website, or possibly newsgroup, devoted to advanced TMP
>>> techniques such as yours.
>> We had a short discussion of the limitations of that technique here:
> I don't understand from your link what those limitations are, although
> it appears it revolves around the comma operator technique used by Eric
> Niebler in his example.
I think the point is that if the expression returns a type that has
itself overloaded the comma operator, then that overload may get
selected, trowing the whole thing off-track. (I'm sure someone will
correct me if I've read it too quickly and missed the point.) Anyway,
that's worth noting, but hardly seems likely to occur in practice.
-- 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