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 ?
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