Why Templates?
Hasan Aljudy
hasan.aljudy at gmail.com
Sat Mar 4 18:30:38 PST 2006
Derek Parnell wrote:
> I'm sure its because I'm not from a C++ background, but I just don't
> get templates. What is the problem that Templates solve?
>
> From my limited experience they just seem to be a shorthand for a way
> of avoiding coding identical algorithms that only vary in the datatypes
> that are passed to them. Is that it or am I missing some fundamental
> elements?
>
> And is that why people are clamoring for implicit template instantation
> - to further reduce the amount of typing to do (and remembering to
> instantiate the only the required renditions of the algorithm).
>
I feel the same.
I do come from C++ background, but I just hate templates! (Now I hate
C++ itself :)
I think templates were introduced in C++ to solve the "no-base-class"
problem. In other words, it's a hack that solves a misfeature in C++.
D's templates are not really templates any more, they're more like a
meta-programming facility. Or so I think, anyway. I don't really
understand templates anyway, not to mention meta programming
More information about the Digitalmars-d
mailing list