Combining variadic functions with class templates
Simen kjaeraas
simen.kjaras at gmail.com
Thu Sep 30 10:58:02 PDT 2010
Sebastian Schuberth <sschuberth at gmail.com> wrote:
> Hi,
>
> 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 ...) {
This is not a constructor, but a malformed function. In D, constructors
bear the name 'this'[1].
> What's wrong with the above code? Can member functions / constructors
> not be variadic? Is is not allowed to use template argument N in static
> array variadic function arguments?
The error is, as said above, the name of your constructor. This leads to
a less-than-readable error message, which ultimately is trying to tell
you what I'm saying.
[1]: http://digitalmars.com/d/2.0/struct.html#Struct-Constructor
--
Simen
More information about the Digitalmars-d-learn
mailing list