Fun with range deprecations

John Colvin via Digitalmars-d digitalmars-d at puremagic.com
Wed Aug 13 01:54:09 PDT 2014


On Tuesday, 12 August 2014 at 19:15:48 UTC, H. S. Teoh via 
Digitalmars-d wrote:
> On the positive side, if these "optional" range methods are 
> templatized,
> they will reduce template bloat in code that doesn't need to 
> use them.
> AFAIK, if you have a template struct with 10 methods, all 10 
> will get
> instantiated when you instantiate the struct, even if you only 
> ever use
> 3 of them in your code. So it seems to be a good thing to 
> templatize the
> "additional" methods like .save, .back, .popBack, .opIndex, 
> which may
> never get used if the user only ever needs the input range 
> methods.


templates to _reduce_ code size, I'd never thought of that before 
(although really this is work that a linker can do).


More information about the Digitalmars-d mailing list