Date: Tue, 7 May 2024 17:04:14 +0200
Or are you looking for a way to specify an explicit template constructor argument list? Possibly with T& reference type?
This would be possible for non-constructor template functions.
Currently the standard says as note:
https://timsong-cpp.github.io/cppwp/temp.arg.explicit#8
[Note 4:
Because the explicit template argument list follows the function template name, and because constructor templates ([class.ctor]) are named without using a function name ([class.qual]), there is no way to provide an explicit template argument list for these function templates.
— end note]
-----Ursprüngliche Nachricht-----
Von:David wang via Std-Proposals <std-proposals_at_[hidden]>
Gesendet:Di 07.05.2024 09:46
Betreff:[std-proposals] Pass derived object by reference to single parameter delegated templated constructors
An:C++ <std-proposals_at_[hidden]>;
CC:David wang <wangjufan_at_[hidden]>;
On Mon, 6 May 2024 10:18:35 -0400 Jason McKesson via Std-Proposals
<std-proposals_at_[hidden] <mailto:std-proposals_at_[hidden]> > wrote:
>This is way too special-case to implement. It's ultimately on the user
>to prevent this from happening. `base`'s constructor uses template
>argument deduction. That function takes its parameter by value. If you
>use template argument deduction on such a function and pass it a type
>which is a reference, it will copy the parameter. This *needs* to be a
>hard-and-fast rule.
It is a special case. It is a conflict between rule and best practices.
But It is not the user's fault. Rules and practices may change or be refined by us.
--
Std-Proposals mailing list
Std-Proposals_at_[hidden]
https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals
Received on 2024-05-07 15:04:16