Just came across some code I wrote some time ago in
irrKlang and was shocked:
template< typename T >
class CMyImpl : public T
{
template< class A, class B, class C, class D, class E,
class F, class G, class H, class I >
CMyImpl(A a, B b, C c, D d, E e, F f, G g, H h, I i)
: T(a,b,c,d,e,f,g,h,i)
{
}
} |
Some parts have been removed, but the code really looks like this and is being used. When I started learning C++ about a decade ago, and I came across code looking like this, I usually was shocked and scrolled away. Looks like now I've become one of those template abusing programmers as well. :)
But joking aside: I still try to avoid templates and only use them for simple types operating on different datatypes like the
Irrlicht's and irrKlang's vector 3D because it confuses other programmers very easily.
Templates can be good though, particularly if they're well used and made clearer through copious typdef usage. Boost and Loki are awesome.