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. template & IMPLEMENT_SERIAL ??

template & IMPLEMENT_SERIAL ??

Scheduled Pinned Locked Moved C / C++ / MFC
jsonhelpquestion
3 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.
  • G Offline
    G Offline
    goupil
    wrote on last edited by
    #1

    hi, i have a problem with the macro IMPLEMENT_SERIAL. Because my class TempClass is Template and when i try to insert the macro into the .h file, the compiler says i have to write the arguments of TempClass. Does someone have an idea ? Here's the code : ******************************************* template class TempClass : public Msg { DECLARE_SERIAL(TempClass ) TempClass(); ~TempClass(); //here the rest of class declaration... virtual void Serialize (CArchive& ar); }; IMPLEMENT_SERIAL(TempClass ,Msg,1) //it crashes here template TempClass ::TempClass () { ... } ...

    T 1 Reply Last reply
    0
    • G goupil

      hi, i have a problem with the macro IMPLEMENT_SERIAL. Because my class TempClass is Template and when i try to insert the macro into the .h file, the compiler says i have to write the arguments of TempClass. Does someone have an idea ? Here's the code : ******************************************* template class TempClass : public Msg { DECLARE_SERIAL(TempClass ) TempClass(); ~TempClass(); //here the rest of class declaration... virtual void Serialize (CArchive& ar); }; IMPLEMENT_SERIAL(TempClass ,Msg,1) //it crashes here template TempClass ::TempClass () { ... } ...

      T Offline
      T Offline
      Tomasz Sowinski
      wrote on last edited by
      #2

      Sorry - you can't use MFC runtime type information with templates. IMPLEMENT_SERIAL/DYNCREATE/DYNAMIC will not work - that's because MFC creates some global variables named after your class name. With templates it simply doesn't work. Tomasz Sowinski -- http://www.shooltz.com

      G 1 Reply Last reply
      0
      • T Tomasz Sowinski

        Sorry - you can't use MFC runtime type information with templates. IMPLEMENT_SERIAL/DYNCREATE/DYNAMIC will not work - that's because MFC creates some global variables named after your class name. With templates it simply doesn't work. Tomasz Sowinski -- http://www.shooltz.com

        G Offline
        G Offline
        goupil
        wrote on last edited by
        #3

        Many Thanks for your respond, it will avoid me long hours of research :))

        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