Steven Schveighoffer wrote:
On Thu, 18 Feb 2010 08:00:55 -0500, Don <[email protected]> wrote:
Including the library implementation:
T[] toArray(T)(T[] values...)
{
return values.dup;
}
int[] array = toArray(x,y,z);
Mutable array literals achieve almost nothing.
I don't think this will work:
toArray(1, 2L, 3.0)
I'm not saying that this is a reason not to consider the change, but it
does note a difference. You can always simply do toArray!double(...) to
get around the limitation.
-Steve
import std.traits: CommonType;
CommonType!(T)[] toArray(T...)(T elements) { ... }
-Lars