Date: Tue, 31 May 2022 17:19:23 -0600
On Tue, 31 May 2022 at 10:24, Edward Catmur <ecatmur_at_[hidden]> wrote:
> "reloc-assign" is just assignment by value: operator=(T). See my email
> just now.
>
While the copy-and-swap (in this case, reloc-and-swap) idiom works fine for
this assignment operator, for gsl::not_null a memberwise implementation
would also work, indicating that this assignment operator should be a
defaultable special member function:
not_null& operator=(not_null) = default;
In turn, this indicates that the spelling for the relocation operator
should simply be T(T) - that is, it should have the syntax of a
constructor. Since a by-value constructor is currently invalid, this is
free syntax.
> "reloc-assign" is just assignment by value: operator=(T). See my email
> just now.
>
While the copy-and-swap (in this case, reloc-and-swap) idiom works fine for
this assignment operator, for gsl::not_null a memberwise implementation
would also work, indicating that this assignment operator should be a
defaultable special member function:
not_null& operator=(not_null) = default;
In turn, this indicates that the spelling for the relocation operator
should simply be T(T) - that is, it should have the syntax of a
constructor. Since a by-value constructor is currently invalid, this is
free syntax.
Received on 2022-05-31 23:19:36