A tutorial on D templates
run3 at myopera.com
Sat Jan 14 08:15:27 PST 2012
On Sat, Jan 14, 2012, at 09:07 AM, Philippe Sigaud wrote:
> >> On 13/01/12 10:48 PM, DNewbie wrote:
> >> > I can't understand it. Why would someone need template programming. What problem does template solve?
> Well read on and see :-)
> >> Suppose you want to write a function to get the minimum of two integers.
> >> It's easy:
> > Oh.. I see.
> > Thank you everybody.
> And that's the first, more visible part of templates, a bit like
> generics in Java.
> Template are incomplete pieces of code with left-empty 'slots' which
> you can fill at compile-time to decide what code will be compiled.
> You can generate entire functions / class hierarchies or nicely
> crafted-for-your-need code / pre-computed-by-the-compiler code with
OK... I won't play with templates for now, but please keep up the good work.
More information about the Digitalmars-d-learn