https://d.puremagic.com/issues/show_bug.cgi?id=12315
--- Comment #6 from [email protected] 2014-03-09 07:11:11 PDT --- (In reply to comment #5) > There are also assumeSafeAppend, reserve/capacity, and so on. I don't know if > they speedup the code at compile-time too. It seems code like this doesn't yet work: import std.traits: ForeachType; import std.range: hasLength; ForeachType!R[] myArray(R)(R r) { if (__ctfe) { typeof(return) result; static if (hasLength!R) result.reserve = r.length; foreach (item; r) result ~= r; return result; } else { // ... assert(0); } } struct Foo1 { int i; } struct Foo2 { immutable int i; } void main() { enum r1 = [Foo1(1)].myArray; // OK enum r2 = [Foo2(1)].myArray; // OK } -- Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
