Date: Mon, 16 Dec 2024 13:02:54 +0100
On 2024-12-16 at 11:50, Oskars Putans via Std-Proposals wrote:
> I failed to consider that it would still use default constructors.
>
> Yes this very basic class would not work because the reference must not
> be trivially copied
>
> By defining our own copy and move constructors we can evade this issue
>
> foo(const foo& other) : actual_value_(other.actual_value_) {}
>
> foo(foo&& other) : actual_value_(other.actual_value_) {}
>
>
Yes, but then you write extra code to avoid writing the getter. :-)
> I failed to consider that it would still use default constructors.
>
> Yes this very basic class would not work because the reference must not
> be trivially copied
>
> By defining our own copy and move constructors we can evade this issue
>
> foo(const foo& other) : actual_value_(other.actual_value_) {}
>
> foo(foo&& other) : actual_value_(other.actual_value_) {}
>
>
Yes, but then you write extra code to avoid writing the getter. :-)
Received on 2024-12-16 12:03:01