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 ?

Reply via email to