Possible solution to template bloat problem?

Ramon spam at thanks.no
Mon Aug 19 17:34:37 PDT 2013


Well, I'm afraid that's what templates are. One (or the compiler) 
fills them in and that's it.

In other words: Templates are compile time while (real) generics 
are run time. This basically comes down to have some way of 
designating classes as, for instance, comparable and then either 
running along the object chain comparing all built in objects 
(with built in compare functionality) or having a compare 
implemented (Of course, there is also arithmetic functions, etc.).

While this sounds great it actually carries some code weight 
("bloat") with it, too because all that functionality must be 
somewhere. It gets (relatively) cheaper though when being heavily 
used.


More information about the Digitalmars-d mailing list