Chain two different struct specialization
Andrea Fontana
nospam at example.com
Fri Mar 1 07:40:24 PST 2013
On Friday, 1 March 2013 at 15:08:21 UTC, bearophile wrote:
>> void main() {
>> immutable s1 = MyStruct(firstWeights, 10, 8);
>> immutable s2 = MyStruct(firstWeights, 9, 10);
>> immutable s3 = MyStruct(secondWeights, 9, 10);
>>
>> import std.stdio;
>> writeln(likeness(s1, s2));
>
> Sorry for the mix of tabs and spaces. The crappy editor I have
> used now has not replaced your tabs with spaces...
>
> Bye,
> bearophile
That's right.
I think you missed an initialization on this(): I fixed it.
BTW, compiler can't guess s1 and s2 weights, should it?
if inside likeness() i write:
enum test = first.weights.foo * second.weights.foo;
it said that can't read first and second value at compile time.
Andrea
More information about the Digitalmars-d-learn
mailing list