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).