template foo(T, U) { T foo(T x, U y) { return x + cast(T)y; } } template bar(T) { T bar(U)(T x, U y) { return x + cast(T)y; } } void main() { int a = 1; long b = 2; auto x = foo(a, a); //auto y = bar(a, b); //error auto y = bar!(long)(a, b); }
I was playing around with some Eponymous Templates. I had been
under the impression that Implicit Function-Template
Instantiation (IFTI) meant that you don't have to explicitly
instantiate all functions. However, it seems like there are cases
with eponymous templates with functions in them that you do. For
instance, in the bar function below, I have to explicitly
instantiate the inner function template.
- IFTI in Eponymous Templates jmh530 via Digitalmars-d-learn
- Re: IFTI in Eponymous Tem... Hiemlick Hiemlicker via Digitalmars-d-learn
- Re: IFTI in Eponymous Tem... ag0aep6g via Digitalmars-d-learn
- Re: IFTI in Eponymous... jmh530 via Digitalmars-d-learn