Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <boost/type_index.hpp>
- #include <iostream>
- #define DEFINE_NAME \
- std::string name \
- { \
- boost::typeindex::type_id<decltype(*this)>().pretty_name() \
- };
- class Test2
- {
- public:
- DEFINE_NAME
- };
- int main()
- {
- Test2 t;
- std::clog << t.name << std::endl; // human readable
- return 0;
- }
- //output :
- // Test2
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement