mercredi 19 décembre 2018

Copy next lines in macro

I would like to make a 'decorator' like macro. The way it would look like:

#define CLASS(name) \
class name\
{\
    void DoClassStuff()\
    {\
        int result = //COPY CODE FROM THE NEXT LINES AND CALL IT;\
    }\
};

CLASS(MyClass)
int GonnaBeCopied() {
   return 10;
}

The result should look like:

class MyClass
{
    void DoClassStuff()
    {
        int result = GonnaBeCopied();
    }
};

Aucun commentaire:

Enregistrer un commentaire