C++ Logo

std-proposals

Advanced search

[std-proposals] Pass derived object by reference to single parameter delegated templated constructors

From: David wang <wangjufan_at_[hidden]>
Date: Tue, 7 May 2024 15:46:05 +0800
On Mon, 6 May 2024 10:18:35 -0400 Jason McKesson via Std-Proposals
<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.

Received on 2024-05-07 07:46:18