Nobody understands templates?
Dominikus Dittes Scherkl
Dominikus.Scherkl at continental-corporation.com
Mon Mar 3 09:24:06 PST 2014
On Monday, 3 March 2014 at 16:40:09 UTC, Chris wrote:
> I'm always willing to use templates, but maybe in fact the use
> cases are limited. I have a class for html elements (that
> implements DOM functionality), and a class for building trees
> with the tags. Of course, for html tags only string as a type
> makes sense.
Really?
Did you consider that there are three different flavors of
"string"?
Does your function really only deal with string?
Or would someone need wstring or dstring?
> class HTMLElement(T) if (is (T == string)) {
>
> }
>
> [...] I don't know [...] if I won't have to modify the template
> to adapt to new data types (which kinda defeats the purpose).
Not much if the different types have common features.
Most times it is still a big save of code to implement, even
if the types need to be handled different in some places.
More information about the Digitalmars-d-learn
mailing list