* asit:
> What is the diifference between generic programming and template meta
> class programming ?
Whatever the people using the terms define them to mean.
To me "generic programming" mainly just implies having types as arguments (in
C++ one can additionally have values as template arguments), like
template< typename T >
void foo( T const& v ) { std::cout << v << endl; }
while "template meta programming" or TMP is about programming in the type
domain, like
template< typename Head, typename Tail >
struct Cons {};
template< typename ConsList >
struct FirstOf;
template< typename AHead, typename ATail >
struct FirstOf< Cons< AHead, ATail > >
{
typedef AHead T;
};
and going on other type domain "operations" like TailOf, Reversed, InheritAll
and so on.
A good introduction is Andrei Alexandrescu's "Modern C++ Design".
Cheers & hth.,
- Alf
|