I wonder how to define a macro that for a given class name displays its namespace and class name in the format, for example: "Namespace.SubNamespace.ClassName"?
So write something like this:
// MyClass.h #include <string> namespace NS { namespace SNS { class MyClass { static std::string str; }; } } //MyClass.cpp #include <MyClass.h> using namespace std; string NS::SNS::MyClass::str = SUPER_MACRO(/*params if needed yet none would be prefered*/);
I want str to be "NS.SNS.MyClass". I would really like the macro to have, if possible, profile parameters (which means one or nothing).
As an alternative, I wonder if this can be done using templates with something like:
string NS::SNS::MyClass::str = GetTypeNameFormater<NS::SNS::MyClass>();
How to do it (using boost, stl and having only C ++ 03 at hand)?
c ++ boost class c ++ 03
Duckquueen
source share