|
Boost : |
Subject: Re: [boost] [config] What Feature is this??
From: Edward Diener (eldiener_at_[hidden])
Date: 2017-07-24 15:18:59
On 7/24/2017 8:29 AM, Andrey Semashev via Boost wrote:
> On 07/24/17 14:37, Edward Diener via Boost wrote:
>> On 7/23/2017 2:50 PM, John Maddock via Boost wrote:
>>> Folks, I think I'm looking to add a new C++11 defect macro, but don't
>>> know what the feature is called, nor can I see a way of detecting it
>>> with clang's __has_feature function.
>>>
>>> The code I want to enable involves function overloading based on a
>>> decltype return type as in:
>>
>> I never realized that function overloading could occur based on any
>> return type. I always thought it had to be based on the parameter
>> types. Is this part of the C+11 standard ? Where in the standard is
>> this specified ?
>
> I think it's not about overloading but about disabling function template
> instantiations via SFINAE.
I am glad to hear that. I misinterpreted the original message and
probably should have realized it. Thanks !
>
>>> auto integrate(args...) -> decltype(expression1);
>>>
>>> auto integrate(args...) -> decltype(expression2);
>>>
>>>
>>> where expression1 and expression2 are two mutually exclusive options
>>> (the conceptual requirements of args means that only one of these 2
>>> will ever be satisfied).
>>>
>>> This works fine in msvc-14 and later and gcc-4.8 and later, but I
>>> don't see any current config macros which cover this case, nor can I
>>> figure out what this trick should be called.
>>>
>>> Alternatively, if anyone has a better way of differentiating between
>>> unary and binary functions I'm happy to hear about it ;)
>>>
>>>
>>> Thanks, John.
>>>
>>>
>>> ---
>>> This email has been checked for viruses by AVG.
>>> http://www.avg.com
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk