undefined references

uri via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sun Aug 10 21:02:11 PDT 2014


On Monday, 11 August 2014 at 03:12:45 UTC, Vlad Levenfeld wrote:
[snip]

> 	this (Elements...)(Elements elements)
> 	if (Elements.length == length)
> 	{
> 		foreach (i, element; elements)
> 			components[i] = element;
> 	}
> 	this (Element element)
> 	{
> 		components[] = element;
> 	}
[snip]

The following gives an error in 2066

struct S(F, size_t L)
{
     F[L] c;
     this(E...)(E el)
     if(E.length == L)
     {
         foreach(i, e; el) {
             c[i]= e;
         }
     }
     this(F e) {
         c[0] = e;
     }
}
void main()
{
     auto s = S!(double, 1)(1);
     auto s = S!(double, 3)(1,2,3); // <-- ERROR: declaration 
hacks.main.s is already defined
}


Cheers,
uri



More information about the Digitalmars-d-learn mailing list