If I defined a class:
class Blah {};
How can I:
std::string const className = /* What do I need to do here? */;
assert( cla
I don't think there's any non-compiler specific solution to such problem that does not involve plenty of macros in the class declaration (actually if I understood correctly the QT documentation the string you get with objectName
is actually assigned "by hand", I think with code created by moc
).
On the other hand, in general to check if the class of an object is one you don't want you shouldn't do a string comparison, but instead make a typeid comparison.
assert(typeid(YourObject)==typeid(Blah));
But probably you should explain better what you're trying to achieve.