samedi 2 septembre 2017

How can I understand, that some code is compiled inside a class?

I have a macro, something like:

#define LOG(level, format, ...)                                \
    Logger::get_logger("default").log_message(level,           \
        __FILE__, __LINE__, __FUNCTION__, typeid(this).name(), \
        format, __VA_ARGS__)

But this macro will be called not only inside class instances. Of course, in a plain function, I can't use this pointer. How can I understand (i.e., using templates, boost::tti and etc), that my code is used inside a class instance or not?

Aucun commentaire:

Enregistrer un commentaire