Date: Thu, 29 Sep 2022 23:42:19 +0100
On Thu, 29 Sept 2022 at 20:57, Lénárd Szolnoki <cpp_at_[hidden]>
wrote:
> Hi,
>
> On 29 September 2022 20:25:06 BST, Edward Catmur <ecatmur_at_[hidden]>
> wrote:
> >On Thu, 29 Sept 2022 at 18:15, Lénárd Szolnoki via Std-Proposals <
> >std-proposals_at_[hidden]> wrote:
> >
> >> I think this could be addressed by two distinct proposals.
> >>
> >> 1. allow placeholders to appear in any deduced context
> (std::vector<auto>)
> >> 2. allow a placeholder to introduce a name (auto<class T>, auto<int i>
> >> might appear as a deduced nttp)
> >>
> >> Then you can have your vector<auto<class T>> to deduce the value type
> and
> >> introduce the name T for that.
> >>
> >
> >std::vector<auto> is problematic, because elsewhere auto means a value of
> >unconstrained type (e.g. in template<auto>).
>
> I disagree. auto is a placeholder for the type of the non-type parameter.
> If you don't omit the name, then that name refers to the value.
>
I'm not sure I understand your objection. Given template<auto> void f();
you can call f<0>(), or f<std::monostate()>(), etc. But you cannot call
f<char>(). So here auto clearly designates a value, not a type.
wrote:
> Hi,
>
> On 29 September 2022 20:25:06 BST, Edward Catmur <ecatmur_at_[hidden]>
> wrote:
> >On Thu, 29 Sept 2022 at 18:15, Lénárd Szolnoki via Std-Proposals <
> >std-proposals_at_[hidden]> wrote:
> >
> >> I think this could be addressed by two distinct proposals.
> >>
> >> 1. allow placeholders to appear in any deduced context
> (std::vector<auto>)
> >> 2. allow a placeholder to introduce a name (auto<class T>, auto<int i>
> >> might appear as a deduced nttp)
> >>
> >> Then you can have your vector<auto<class T>> to deduce the value type
> and
> >> introduce the name T for that.
> >>
> >
> >std::vector<auto> is problematic, because elsewhere auto means a value of
> >unconstrained type (e.g. in template<auto>).
>
> I disagree. auto is a placeholder for the type of the non-type parameter.
> If you don't omit the name, then that name refers to the value.
>
I'm not sure I understand your objection. Given template<auto> void f();
you can call f<0>(), or f<std::monostate()>(), etc. But you cannot call
f<char>(). So here auto clearly designates a value, not a type.
Received on 2022-09-29 22:42:32