The syntax of sort and templates

nkm1 via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Fri May 26 04:52:36 PDT 2017


On Friday, 26 May 2017 at 11:27:19 UTC, zakk wrote:
> I have a followup question: my background is C and in Wolfram 
> Mathematica, so my
> knowledge of templates is limited to trivial examples in C++... 
> It seems to me that
> when programming in D templates are something more powerful

Even in C++ templates can work with more than just types (e.g., 
C++ templates accept other templates, numbers and pointers). And 
of course, D templates are even more powerful than in C++, so 
they can work with even more things:

TemplateTypeParameter
TemplateValueParameter
TemplateAliasParameter
TemplateSequenceParameter
TemplateThisParameter

(you can read about it here: 
https://dlang.org/spec/template.html#TemplateParameters)


More information about the Digitalmars-d-learn mailing list