Skip to content

Commit 42b309f

Browse files
committed
typeinfo: add pretty_name to std::type_index
1 parent 2a9b3b5 commit 42b309f

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/type_info.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,13 @@ void exposeStdTypeIndex() {
3131
"Returns an implementation defined null-terminated character string "
3232
"containing the name of the type. No guarantees are given; in "
3333
"particular, the returned string can be identical for several types "
34-
"and change between invocations of the same program.");
34+
"and change between invocations of the same program.")
35+
.def(
36+
"pretty_name",
37+
+[](const Self &value) -> std::string {
38+
return boost::core::demangle(value.name());
39+
},
40+
bp::arg("self"), "Human readible name.");
3541
}
3642

3743
void exposeBoostTypeIndex() {

0 commit comments

Comments
 (0)