Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. templates with multiple params in macros

templates with multiple params in macros

Scheduled Pinned Locked Moved C / C++ / MFC
questionc++csswpftutorial
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    Jason De Arte
    wrote on last edited by
    #1

    (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() };

    M 1 Reply Last reply
    0
    • J Jason De Arte

      (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() };

      M Offline
      M Offline
      Michael Dunn
      wrote on last edited by
      #2

      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:

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups