Hi all,
I've been learning D for a few weeks by reading through Programming In D [1] and had a question about Eponymous Template section [2]. Here's the example:

```
template LargerOf(A, B) {
  static if (A.sizeof < B.sizeof) {
    alias LargerOf = B;

  } else {
    alias LargerOf = A;
  }
}

LargerOf!(A, B) calculate(A, B)(A a, B b) {
  LargerOf!(A, B) result;
  return result;
}

pragma(msg, typeof(calculate));
```

At build time instead of printing:
```
LargerOf!(A, B)(A, B)(A a, B b)
```

it prints:
```
double(double lhs, double rhs)
```

Is there some reason it specializes to `double`?

-deech
[1] http://ddili.org/ders/d.en/index.html
[2] http://ddili.org/ders/d.en/templates_more.html

Reply via email to