Fun with templates
Dicebot
public at dicebot.lv
Mon Jul 8 03:51:47 PDT 2013
On Monday, 8 July 2013 at 03:03:30 UTC, Martin Nowak wrote:
> On 07/07/2013 01:19 PM, Marco Leise wrote:
>> If you wanted to save on template instantiations for every
>> possible attribute combination, you are doing it wrong. Those
>> are already 3 duplicate templates with binary identical
>> functions foo(int a) in them, which makes me cry on the inside.
>
> There is a linker optimization to get rid of the duplicates.
> http://msdn.microsoft.com/en-us/library/bxwfs976(v=vs.110).aspx
Linker alone can't possibly know all required information to make
a proper clean up - and duplicates are not main bloat cause. It
needs to work in team with a compiler, possibly with a help of a
type system.
More information about the Digitalmars-d
mailing list