Skip to content

Commit

Permalink
Any新增type_name方法
Browse files Browse the repository at this point in the history
  • Loading branch information
xia-chu committed Sep 2, 2023
1 parent 97f9b9a commit 5d74e09
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/Util/util.h
Original file line number Diff line number Diff line change
Expand Up @@ -410,6 +410,13 @@ class Any {
return *this;
}

std::string type_name() const {
if (!_type) {
return "";
}
return demangle(_type->name());
}

private:
const std::type_info* _type = nullptr;
std::shared_ptr<void> _data;
Expand Down

0 comments on commit 5d74e09

Please sign in to comment.