C++ Logo

std-discussion

Advanced search

Re: Partial ordering of function template which have a place holder for deduced class type in the template parameter list.

From: Ville Voutilainen <ville.voutilainen_at_[hidden]>
Date: Mon, 3 Aug 2020 01:43:31 +0300
On Mon, 3 Aug 2020 at 01:33, Jason McKesson via Std-Discussion
<std-discussion_at_[hidden]> wrote:
>
> On Sun, Aug 2, 2020 at 2:30 PM Olivier Kannengieser via Std-Discussion
> <std-discussion_at_[hidden]> wrote:
> >
> > No this is what I meant. 'A x' is a C++20 feature: place holder for deduced class type for the declaration of non type template parameter.
>
> No, "place holder for deduced class type for the declaration of non
> type template parameter" is the C++17 feature that allows `auto x` to
> work in template arguments. A template name by itself is not a
> placeholder.
>
> C++20 allows `ConceptName auto x`, which does the above except with a
> concept constraint as to `x`'s type.
>
> At no point does C++ permit `TemplateName x` to work in a template
> parameter list. There were some Concept ideas that `TemplateName<auto>
> x` might work, and maybe Concepts TS allowed you to drop the argument.
> But C++20 does not.

I'm not sure what you mean by "TemplateName x", but this certainly does work:

template <class T> concept foo = /* whatever */;

template <foo T> void f(); // or struct, class, etc.

That foo is probably not what you mean by TemplateName, because it's a
ConceptName.

Received on 2020-08-02 17:47:04