Properties and std.container.Array

Frustrated c1514843 at drdrb.com
Thu Jan 9 04:13:13 PST 2014


I've tried insert, indexing, ~=, etc but the length always 
returns 0.

e.g.,

std.container.Array!int arr;
arr ~= 3;
writeln(arr.length);

works fine, but when the array is a property of a class, it does 
not work, e.g.,

class x
{
std.container.Array!int _arr;
@property std.container.Array!int arr() { return _arr; }
@property std.container.Array!int arr(std.container.Array!int a) 
{_arr = a; return _arr; }
}

if I use _arr directly then everything works.

Why are properties screwing up std.container.Array?



More information about the Digitalmars-d-learn mailing list