Templates do maybe not need to be that slow (no promises)
Marco Leise via Digitalmars-d
digitalmars-d at puremagic.com
Fri Sep 9 04:28:23 PDT 2016
Am Fri, 09 Sep 2016 10:32:59 +0000
schrieb Stefan Koch <uplink.coder at googlemail.com>:
> On Friday, 9 September 2016 at 09:31:37 UTC, Marco Leise wrote:
> >
> > Don't worry about this special case too much. At least GCC can
> > turn padLength from a runtime argument into a compile-time
> > argument itself, so the need for templates to do a poor man's
> > const-folding is reduced. So in this case the advise is not to
> > use a template.
>
> This is not what this is about.
> This is about cases where you cannot avoid templates because you
> do type-based operations.
>
> The code above was just an example to illustrate the problem.
Fair enough. I hope there is a less complex solution that all
compilers could benefit from.
--
Marco
More information about the Digitalmars-d
mailing list