Move Constructor Syntax

H. S. Teoh hsteoh at qfbox.info
Mon Oct 7 18:04:58 UTC 2024


On Mon, Oct 07, 2024 at 05:42:53PM +0000, Guillaume Piolat via Digitalmars-d wrote:
> On Monday, 7 October 2024 at 17:29:20 UTC, Dejan Lekic wrote:
> > On Sunday, 6 October 2024 at 04:04:28 UTC, Walter Bright wrote:
> > > It may take a bit of getting used to. I kinda prefer (1) as it is
> > > sorta like `~this()`.
> > 
> > Maybe silly idea, but could we name it moveThis() and copyThis() ??
> 
> How about reusing one of those shift operators keyword.
> 
> this<<<(T other)

What about:

	this(~T t)

The ~ being an allusion to ~this, the idea being that after the move the
operand t will effectively have been destructed and invalid.


T

-- 
Why waste time reinventing the wheel, when you could be reinventing the engine? -- Damian Conway


More information about the Digitalmars-d mailing list