Thread: Implement_serial_new

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654

    Implement_serial_new

    If anyone has any idea, I'd be grateful. Basically, I'm trying to make some class serializable with CArchive, but it isn't working out too well, because I can't get the macro IMPLEMENT_SERIAL_NEW to work.
    The problem lies in that the class CIndex is nested inside CRegistry (and also declared private). Typing CRegistry::CIndex and passing it to the macro causes major compile errors due to the way it's structured.
    So I've tried a typedef CRegistry::CIndex CIndex; which doesn't work because it's private! Neither can I actually make a friend or anything because it's in global scope level.

    The current solutions seems to be to re-define IMPLEMENT_SERIAL_NEW and all its depending macros to take an extra arg - the full class path and class name or make CIndex public or moving it outside CRegistry.
    Are there any other viable solutions to a problem like this?

    Oh yes, I tried doing it in the header, inside the encapsuling class, but then it would complain with all sorts of errors such as cannot overload static and non-static functions of the same name or something? And also cannot overload a function from an interface it isn't derived from or some such.
    Last edited by Elysia; 12-05-2007 at 02:04 PM.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

Popular pages Recent additions subscribe to a feed