-
Notifications
You must be signed in to change notification settings - Fork 266
Closed
Labels
Description
How on earth do I write a move constructor that resets the moved from object? (Like setting pointers to null or the like).
Going from this:
struct Bar {
int b = 5;
Bar(int b_): b(b_) {}
Bar(Bar& that) {
this->b = that.b;
that.b = 0;
}
};I tried to write this:
Foo: @struct type = {
public a: i32 = 5;
operator=: (out this, a_: i32) = {
a = a_;
}
operator=: (out this, inout that) = {
this.a = that.a + 1;
that.a = 0;
}
}But I'm only allowed to use in or move for that? Surely this is not just unsupported?
Sorry to take up space in the issue tracker, but I'm not aware of any better forum.