C++ Logo

SG10

Advanced search

Subject: Re: [isocpp-core] Feature-test macro for ADL calls with template arguments?
From: Barry Revzin (barry.revzin_at_[hidden])
Date: 2020-06-09 09:49:06


On Tue, Jun 9, 2020 at 9:43 AM Ville Voutilainen <
ville.voutilainen_at_[hidden]> wrote:

> On Tue, 9 Jun 2020 at 17:39, Barry Revzin <barry.revzin_at_[hidden]> wrote:
>
> > I guess Qt just needs to make sure that its sufficiently uninvokable
> get() in the global namespace doesn't conflict with other libraries that
> want to do the same thing. So you could do:
> >
> > namespace voldemort::qt::lol { class get_tag { explicit get_tag(int); };
> }
> > template <typename T> void get(voldemort::qt::lol::get_tag );
> >
> > That works with Marc's example (gcc 7.1 and clang 6):
> https://godbolt.org/z/NAB3G3 and seems ... rather unlikely ... to
> conflict with anything. You could just provide this unconditionally?
>
> This is not a Qt-specific issue. If it were, you wouldn't have heard
> about it. These work-arounds are exactly the opposite
> of what we want to do wrt the simplicity that Gaby is talking about,
> and a feature-testing macro paves the migration
> road to get to that simpler world.
>

Okay, but what would you do with the feature test macro if not:

#ifndef __cpp_adl_template_whatever
namespace voldemort::qt::lol { class get_tag { explicit get_tag(int); }; }
template <typename T> void get(voldemort::qt::lol::get_tag );
#endif

?

Barry



SG10 list run by sg10-owner@lists.isocpp.org