Combining variadic functions with class templates

Sebastian Schuberth sschuberth at gmail.com
Thu Sep 30 11:13:04 PDT 2010


On 30.09.2010 19:58, Simen kjaeraas wrote:

> This is not a constructor, but a malformed function. In D, constructors
> bear the name 'this'[1].

Doh, thanks, I should have already known that ... changing "Vector" to 
"this" makes it better, but with

struct Vector(alias N,T)
{
     this(T[N] v ...) {
         data=v;
     }

     T data[N];
};

alias Vector!(3,float) Vec3f;

void main()
{
     Vec3f v(1,1,1);
}

I still get

Building Release\ConsoleApp1.exe...
main.d(14): found 'v' when expecting ';' following statement
Building Release\ConsoleApp1.exe failed!

-- 
Sebastian Schuberth


More information about the Digitalmars-d-learn mailing list