On Friday, 16 August 2019 at 12:23:01 UTC, Newbie2019 wrote:
I has this simple function has some memory bugs:
-------
struct TreeRange {
@disable this() ;
@disable this(this) ;
}
struct Tree {
ref auto getRange() return scope {
return TreeRange!T(_root);
}
}
Tree tree;
auto range = tree.getRange();
------
when I trace the issue, I find the address for TreeRange is
moved. it TreeRange.__ctor the address is 0x7ffeefbfd168,
but "auto range = tree.getRange();" address is 0x7ffeefbfd420
How to prevent this struct move in this case ?
With dip1014 I can fix the internal pointer(but I guess It will
need maybe 1 years late to implement). Right now I just want
forbit the move action, is it doable ?