DConf Day 1 Panel with Walter Bright and Andrei Alexandrescu

safety0ff via Digitalmars-d-announce digitalmars-d-announce at puremagic.com
Fri Jun 27 19:46:24 PDT 2014


On Saturday, 28 June 2014 at 02:02:28 UTC, Peter Alexander wrote:
> 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

Awesome, thanks!


More information about the Digitalmars-d-announce mailing list