Ohh, look now, I'm a language nut, so I wouldn't know where to begin... all the languages you know belong squarely in the C family of languages. There are plenty of alternatives.

The classic example of templates are LISP macros, they are just as powerful as C++ templates, and thanks to LISPs extremly regular (some might say foolishly so) syntax they integrate extremly cleanly into LISP. You write LISP macros in, well, LISP. The same goes for the hygenic macros of Scheme, a LISP family member. OCaml is just yet another language that comes with a macro/template system, Camlp4, http://caml.inria.fr/camlp4/. I've heard cool things about Dylan macros. Rebol has a powerful syntax extending mechanism. All of these work within the target language.

Many languages, Ada, Eiffel, Haskell, and the ML family of languages (of which OCaml is one) provide (slightly varying forms of) generics or parametric polymorphism. This provides a very common part of C++ template functionality (based on STL usage), type generic code, in much cleaner ways. In the ML family type genericity is actually the default. Java will have genericity by 1.5, gone will be all the up/down casts to the container classes.

Other languages, such as Prolog, have such an powerful notion of operator overloading and definition that many syntactical tricks can be played with this alone. Haskell has the same kind of power but it also has lazy semantics which alleviate the need for templates as syntactic trickery quite a bit. Smalltalk avoid the need for much macro trickery by being dynamically typed and having anonymous code block that are real closures.



LISP macro intro: http://www.apl.jhu.edu/~hall/Lisp-Notes/Macros.html
Scheme dito: http://www.cs.utexas.edu/users/wilson/schintro/schintro_128.html#SEC180
Camlp4: http://caml.inria.fr/camlp4/
Dylan: http://www.gwydiondylan.org/drm/drm_76.htm#HEADING76-0
Random research: http://portal.acm.org/citation.cfm?id=155105&jmp=indexterms&dl=portal&dl=ACM