digitalmars.D - Array creating expression
- bernhard at dragoneyrie dot de <bernhard_member pathlink.com> Jul 10 2004
- Andy Friesen <andy ikagames.com> Jul 10 2004
I think, it would be useful to create an array as expression.
It could look like:
void blubb(float f) {
float a[];
// ...
a = new float[](f,-f,3*f);
// doing anything with a;
}
Jul 10 2004
bernhard at dragoneyrie dot de wrote:I think, it would be useful to create an array as expression. It could look like: void blubb(float f) { float a[]; // ... a = new float[](f,-f,3*f); // doing anything with a; }
This should tide you over: import std.stdarg; template MakeArray(T) { T[] MakeArray(...) { T[] result; result.length = _arguments.length; foreach (int i, TypeInfo ti; _arguments) { assert(typeid(T) is ti); // FIXME: breaks under inheritance result[i] = va_arg!(T)(_argptr); } return result; } } -- andy
Jul 10 2004








Andy Friesen <andy ikagames.com>