On Thursday, 14 June 2012 at 23:57:36 UTC, Roman D. Boiko wrote:
immutable struct Node{ string s; } Node[] f() { Node[] arr = ...? return arr; }How to fill an array, if its elements are immutable? I want to assign values calculated by some function.
I recall this in TDPL, you can append to an array as it doesn't change it's contents, only the range the array holds... So...
Node[] f()
{
immutable(Node)[] arr;
arr ~= Node("something"); //should work?
return arr;
}
