templates with multiple params in macros
-
(Using WTL) How can I put multiple template params (>1) in a macro definition? I've been using CHAIN_MSG_MAP() to pass messages to templatized base classes with ease for quite a while now. But today I decided to get a little fancy & in turn break things horribly. Take the following as an example, the first CHAIN_MSG_MAP works, but why does the second cause a host of compiler errors? If I use a typedef of the multiple param base class, all will work - but why? There has got to be a method that feels less like a hack. //////////// template class CWorks { public: BEGIN_MSG_MAP(CWorks) END_MSG_MAP() }; template class CBroken { public: BEGIN_MSG_MAP(CBroken) END_MSG_MAP() }; class CMyWindow : public CWindowImpl, public CWorks public CBroken { public: BEGIN_MSG_MAP(CMyWindow) CHAIN_MSG_MAP( CWorks ) CHAIN_MSG_MAP( CBroken ) END_MSG_MAP() };
-
(Using WTL) How can I put multiple template params (>1) in a macro definition? I've been using CHAIN_MSG_MAP() to pass messages to templatized base classes with ease for quite a while now. But today I decided to get a little fancy & in turn break things horribly. Take the following as an example, the first CHAIN_MSG_MAP works, but why does the second cause a host of compiler errors? If I use a typedef of the multiple param base class, all will work - but why? There has got to be a method that feels less like a hack. //////////// template class CWorks { public: BEGIN_MSG_MAP(CWorks) END_MSG_MAP() }; template class CBroken { public: BEGIN_MSG_MAP(CBroken) END_MSG_MAP() }; class CMyWindow : public CWindowImpl, public CWorks public CBroken { public: BEGIN_MSG_MAP(CMyWindow) CHAIN_MSG_MAP( CWorks ) CHAIN_MSG_MAP( CBroken ) END_MSG_MAP() };
CHAIN_MSG_MAP( CBroken<CMyWindow,TRUE> ) Use a typedef to get rid of the comma (which is the source of the problem).
typedef CBroken<CMyWindow,TRUE> theBrokenClass;
CHAIN_MSG_MAP( theBrokenClass )--Mike-- http://home.inreach.com/mdunn/ #include "witty_sig.h" :love: your :bob: with :vegemite: and :beer: