lundi 1 février 2016

C++ Macros and overloading

I am working with c++ Macros, trying to implement on certain pattern. I have the following 3 macros:

#define First Objct t; t
#define Second a() / b()
#define Third ;

I've overload the lambda-ops in format: Objct [ Objct ]

So when I have in main() a line like: First [ Second ] Third , it works fine, as it's 'translated' into: Objct t; t[a()/b()] (note: a() and b() are dummy functions returning type object.)

The hard part, is that I also have to make it work without the lambdas. First Second Third which means

Objct t; t a() / b()

In that case, I got a semicolon missing from FIRST to SECOND. I'm trying to figure out, what changes could be made (probably) to FIRST macro so it can compile in both cases. I'm not sure if I managed to explain myself properly. Any ideas?

Aucun commentaire:

Enregistrer un commentaire