From 42b309f467241a71d419c1a040a4bda3b6747f41 Mon Sep 17 00:00:00 2001 From: Justin Carpentier <justin.carpentier@inria.fr> Date: Tue, 3 Sep 2024 14:35:46 +0200 Subject: [PATCH] typeinfo: add pretty_name to std::type_index --- src/type_info.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/type_info.cpp b/src/type_info.cpp index a3203cce..98e1e44f 100644 --- a/src/type_info.cpp +++ b/src/type_info.cpp @@ -31,7 +31,13 @@ void exposeStdTypeIndex() { "Returns an implementation defined null-terminated character string " "containing the name of the type. No guarantees are given; in " "particular, the returned string can be identical for several types " - "and change between invocations of the same program."); + "and change between invocations of the same program.") + .def( + "pretty_name", + +[](const Self &value) -> std::string { + return boost::core::demangle(value.name()); + }, + bp::arg("self"), "Human readible name."); } void exposeBoostTypeIndex() { -- GitLab