Chain two different struct specialization
bearophile
bearophileHUGS at lycos.com
Fri Mar 1 08:32:27 PST 2013
Andrea Fontana:
> but:
>
> enum s1 = MyStruct(firstWeights, 10, 8);
> enum s2 = MyStruct(firstWeights, 9, 10);
>
> writeln(likeness(s1, s2));
>
> still gives error: and s1 and s2 are known at compile time,
> aren't them?
Right. But they are known at compile-time only outside likeness().
> Your solution will create code for each item couple, isn't it?
Right.
> Not good in my case :) Other ideas?
Another solution is to use indirection, with classes or unsafe
casts. Or to use variants. No solution is perfect.
Why do you want to perform those computations at compile-time?
Bye,
bearophile
More information about the Digitalmars-d-learn
mailing list