On 4/10/2015 2:11 PM, Martin Nowak wrote:
On 04/09/2015 01:10 AM, Walter Bright wrote:http://wiki.dlang.org/DIP77In the first problem example: struct S { RCArray!T array; } void main() { auto s = S(RCArray!T([T()])); // s.array's refcount is now 1 foo(s, s.array[0]); // pass by ref } void foo(ref S s, ref T t) { s.array = RCArray!T([]); // drop the old s.array t.doSomething(); // oops, t is gone } What do you do to pin s.array? auto tmp = s; or auto tmp = s.array;
The latter.