I am writing a piece of software around a framework and a class I am using (to be precise, extending) was renamed in a later version. Is there some way to write some macros/templates in C++11 in order to determine if a class with a certain name had been declared at the point in code?
An illustration of what I'm trying to accomplish follows. Let's say that file class_include.h contains either the definition of class A:
class A
{
...
};
or class B:
class B
{
...
};
and class C tries to extend whichever of those is declared:
#include <class_include.h>
#if (class A is declared)
class C : public A
#else // class B is declared
class C : public B
#endif
{
...
};
Note: It came to my mind to try and check a version of the framework but the answer to this question interests me. I also cannot change any framework include files.
Aucun commentaire:
Enregistrer un commentaire