Subject: Re: [isocpp-core] Feature-test macro for ADL calls with template arguments?
From: Ville Voutilainen (ville.voutilainen_at_[hidden])
Date: 2020-06-08 19:22:59
On Tue, 9 Jun 2020 at 03:01, Richard Smith <richardsmith_at_[hidden]> wrote:
>> We have a language fix that makes hidden friend templates work with
>> ADL when template arguments are provided
>> for a call. We have work-arounds that don't come even close to
>> achieving the same functionality.
> The way I see it is that we have an idiom (or "workaround" if you prefer) that works reliably and provides a superset of the functionality of P0846. (The language-level approach, by contrast, works in strictly fewer cases, and lacks the functionality of letting you choose to provide a custom fallback.) What functionality is missing from the 'using + ADL call' idiom that P0846 provides?
Simplicity. I need to write that using-declaration near every call
site where I want to invoke get<>. That's not
a functionality-superset, it's a completely different thing, a
completely different API flavor. And for users
who by and large prefer not to be bothered with namespaces everywhere,
it's a completely inferior
API flavor, and an incredibly noisy one at that.
>> It would seem
>> rather reasonable to allow programmers to detect when they can use the
>> new superior functionality.
> The SG10 policy has historically been to not include a feature test macro where there is a simple syntactic alternative that gets you the same functionality regardless of compiler support. As far as I'm aware, there is, in this case.
I am yet to see a simple syntactic alternative in this thread. But
well, if this is not a reasonable feature-macro
addition for SG10, then we'll live without it. To me, it seems exactly
the kind of feature-detection use case a feature-testing
macro is good for.
SG10 list run by email@example.com