DConf Day 1 Panel with Walter Bright and Andrei Alexandrescu

Peter Alexander via Digitalmars-d-announce digitalmars-d-announce at puremagic.com
Fri Jun 27 19:02:27 PDT 2014


On Friday, 27 June 2014 at 23:30:39 UTC, safety0ff wrote:
> 2) With regard to reducing template instantiations:
> I've been using a technique similar to the one mentioned in the 
> video: separating functions out of templates to reduce bloat.
> My question is: does a template such as:
> T foo(T)(T x)
> if (isIntegral!T) { return x; }
>
> Get instantiated multiple times for const, immutable, etc. 
> qualifiers on the input?

Yes, but bear in mind that those qualifiers are often stripped
with IFTI, e.g.:

int a;
const int b;
immutable int c;
foo(a);
foo(b);
foo(c);

These all call foo!int


More information about the Digitalmars-d-announce mailing list