I'm still trying to get the swing of metaprogramming, and I'm stumped.
What's I'd like to do is create a class/struct/whatever, supply it a std::tuple and have it automatically generate member functions based on the object types in the tuple. The goal is to have classes derive from MessageHandler
e.g.
typedef std::tuple< MessageA, MessageB, MessageC > MessageSet;
template< class T >
class MessageHandler
{
// some magic metaprogramming would "create"...
virtual void processMsg( const MessageA& ) = 0;
virtual void processMsg( const MessageB& ) = 0;
virtual void processMsg( const MessageC& ) = 0;
};
I've read that you can't have virtual functions in templates, but I didn't know if that was still true for C++11.
Thanks.