Date: Tue, 3 May 2022 10:54:46 +0200
On 2022-05-03 at 08:38, Abdullah Qasim via Std-Proposals wrote:
> For explicit templates:
>
> explicit template <typename T, typename U, typename ...V>
>
> T Func ()
Never happened to me that I don't want *any* of the template parameters
deduced. Do you have a compelling use case for this? One that happens
more often than once every 10 years?
>
> For *_selective_*explicit templates
>
> Template <explicit typename T, typenname U, typename ...V>
>
> T Func ()
If T is the return type, like in
T Func(U, V...)
this is the way it already works. Return types are not deduced.
>
> For explicit constructors:
>
> template <typename T>
>
> explicit T Class<T>::Class (T var)
This is the way it used to work, and it was really annoying.
In
Class<int> i{5};
Class<double> d{1.0};
why would you want to *force* the type (like we did in old C++)?
And in the rare case when it would be somehow useful, you can still do
Class<T>::Class<std::type_identity_t<T> var);
without needing a language change for something that it already
available as a library feature.
>
> *From: *Jason McKesson via Std-Proposals
> <mailto:std-proposals_at_[hidden]>
> *Sent: *01 May 2022 21:51
> *To: *std-proposals_at_[hidden] <mailto:std-proposals_at_[hidden]>
> *Cc: *Jason McKesson <mailto:jmckesson_at_[hidden]>
> *Subject: *Re: [std-proposals] Explicit keyword for template parameters
>
> On Sun, May 1, 2022 at 5:06 AM Jens Maurer via Std-Proposals
> <std-proposals_at_[hidden]> wrote:
> >
> > On 01/05/2022 09.46, Abdullah Qasim via Std-Proposals wrote:
> > > How about:
> > >
> > >
> > >
> > > explicit template <typename T, typename U, typename ...V>
> > >
> > > T Func(U u, V... v)
> > >
> > >
> > >
> > > ??
> >
> > If "Func" is a constructor, how do you differentiate between
> > the current meaning of "explicit" on a constructor and the
> > new meaning?
>
> Equally importantly, how do you differentiate between some parameters
> which should be deduced and some that shouldn't?
> --
> Std-Proposals mailing list
> Std-Proposals_at_[hidden]
> https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals
> <https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals>
>
>
> For explicit templates:
>
> explicit template <typename T, typename U, typename ...V>
>
> T Func ()
Never happened to me that I don't want *any* of the template parameters
deduced. Do you have a compelling use case for this? One that happens
more often than once every 10 years?
>
> For *_selective_*explicit templates
>
> Template <explicit typename T, typenname U, typename ...V>
>
> T Func ()
If T is the return type, like in
T Func(U, V...)
this is the way it already works. Return types are not deduced.
>
> For explicit constructors:
>
> template <typename T>
>
> explicit T Class<T>::Class (T var)
This is the way it used to work, and it was really annoying.
In
Class<int> i{5};
Class<double> d{1.0};
why would you want to *force* the type (like we did in old C++)?
And in the rare case when it would be somehow useful, you can still do
Class<T>::Class<std::type_identity_t<T> var);
without needing a language change for something that it already
available as a library feature.
>
> *From: *Jason McKesson via Std-Proposals
> <mailto:std-proposals_at_[hidden]>
> *Sent: *01 May 2022 21:51
> *To: *std-proposals_at_[hidden] <mailto:std-proposals_at_[hidden]>
> *Cc: *Jason McKesson <mailto:jmckesson_at_[hidden]>
> *Subject: *Re: [std-proposals] Explicit keyword for template parameters
>
> On Sun, May 1, 2022 at 5:06 AM Jens Maurer via Std-Proposals
> <std-proposals_at_[hidden]> wrote:
> >
> > On 01/05/2022 09.46, Abdullah Qasim via Std-Proposals wrote:
> > > How about:
> > >
> > >
> > >
> > > explicit template <typename T, typename U, typename ...V>
> > >
> > > T Func(U u, V... v)
> > >
> > >
> > >
> > > ??
> >
> > If "Func" is a constructor, how do you differentiate between
> > the current meaning of "explicit" on a constructor and the
> > new meaning?
>
> Equally importantly, how do you differentiate between some parameters
> which should be deduced and some that shouldn't?
> --
> Std-Proposals mailing list
> Std-Proposals_at_[hidden]
> https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals
> <https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals>
>
>
Received on 2022-05-03 08:55:19