On Tuesday, 9 November 2021 at 19:30:20 UTC, tchaloupka wrote:
On Monday, 8 November 2021 at 23:26:39 UTC, tchaloupka wrote:
Bug or feature? :)
I've reported it in
https://issues.dlang.org/show_bug.cgi?id=22498.
It doesn't copy. It just destructs the same object twice... Ouch.
Change the
On Monday, 8 November 2021 at 23:26:39 UTC, tchaloupka wrote:
Bug or feature? :)
I've reported it in
https://issues.dlang.org/show_bug.cgi?id=22498.
On Tuesday, 9 November 2021 at 02:43:55 UTC, jfondren wrote:
On Tuesday, 9 November 2021 at 02:41:18 UTC, jfondren wrote:
The expectation is probably that `f.move` set `f` to
`Foo.init`, but the docs say:
Posted too fast. Foo qualifies with its @disable:
```d
struct A { int x; }
struct B {
On Tuesday, 9 November 2021 at 02:41:18 UTC, jfondren wrote:
The expectation is probably that `f.move` set `f` to
`Foo.init`, but the docs say:
Posted too fast. Foo qualifies with its @disable:
```d
struct A { int x; }
struct B { int x; @disable this(this); }
unittest {
import
On Tuesday, 9 November 2021 at 02:19:28 UTC, Stanislav Blinov
wrote:
On Monday, 8 November 2021 at 23:26:39 UTC, tchaloupka wrote:
```
auto gen() {
Foo f; // <--- this one
f.n = 42;
return value(f.move());
}
void main() {
Foo f;
f = gen().unwrap.move;
}
On Monday, 8 November 2021 at 23:26:39 UTC, tchaloupka wrote:
```
auto gen() {
Foo f; // <--- this one
f.n = 42;
return value(f.move());
}
void main() {
Foo f;
f = gen().unwrap.move;
}
```
~this(0)
~this(0)
~this(0)
~this(42) <- this is a copy (that
Lets have this code:
```D
import core.lifetime : forward;
import core.stdc.stdio;
import std.algorithm : move;
struct Value(T) {
private T storage;
this()(auto ref T val) {
storage = forward!val;
}
ref inout(T) get() inout {
return storage;
}
}
Value!T