digitalmars.D.learn - Re: Combining variadic functions with class templates
- bearophile <bearophileHUGS lycos.com> Sep 30 2010
Sebastian Schuberth:I'm all new to D (coming from C++), and currently playing around with the language. I'm using DMD 2.049 and was expecting this to compile: struct Vector(alias N,T) { Vector(T[N] v ...) { data=v; } T data[N]; }; alias Vector!(3,float) Vec3f; void main() { Vec3f v(1,1,1); }
This is interesting code, thank you. Others have already shown you the two bugs in your code, plus other ways to design it. At the end of struct/enum/class definitions don't put a semicolon, it's not needed in D. I have filed an enhancement request about those error messages: http://d.puremagic.com/issues/show_bug.cgi?id=4962 Bye, bearophile
Sep 30 2010