Run Code  | API  | Code Wall  | Misc  | Feedback  | Login  | Theme  | Privacy  | Patreon 

SO typeindex pretty_name

#include <boost/type_index.hpp>
#include <iostream>

class MyObject { public: virtual ~MyObject() {} };
struct Derived : MyObject {};

int main() {
    MyObject o;
    Derived d;

    std::cout << boost::typeindex::type_id<MyObject>().pretty_name() << "\n";
    std::cout << boost::typeindex::type_id<Derived>().pretty_name() << "\n";

    MyObject& r = d;
    std::cout << boost::typeindex::type_id_runtime(r).pretty_name() << "\n";
}
 run  | edit  | history  | help 0