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.

Reply via email to