DIP 1014
RazvanN
razvan.nitu1305 at gmail.com
Wed Jul 3 09:31:38 UTC 2019
On Wednesday, 3 July 2019 at 08:27:49 UTC, RazvanN wrote:
> On Tuesday, 2 July 2019 at 23:05:14 UTC, Manu wrote:
>> On Tue, Jul 2, 2019 at 5:51 PM RazvanN via Digitalmars-d
>> <digitalmars-d at puremagic.com> wrote:
Also there is the problem of typechecking the move operator as a
function.Let's take a look at a slightly modified version of the
example that Shachar provided:
struct Tracker {
static uint globalCounter;
uint localCounter;
uint* counter;
@disable this(this);
this(bool local) {
localCounter = 0;
if( local )
counter = &localCounter;
else
counter = &globalCounter;
}
void increment() {
(*counter)++;
}
//void opPostMove(const ref Tracker oldLocation) {
void opPostMove(immutable ref Tracker oldLocation) immutable {
if( counter is &oldLocation.localCounter )
counter = &localCounter;
}
}
This code will not compile even though it should. And here we
open the door of the postblit problems.
More information about the Digitalmars-d
mailing list