diff --git a/runtime/meta_utils.h b/runtime/meta_utils.h index f2e1baa..737a200 100644 --- a/runtime/meta_utils.h +++ b/runtime/meta_utils.h @@ -32,8 +32,7 @@ RemoveWhiteSpace(const std::string &name, const std::string &chars = "[]<>,&* ") if (compact_name[i] == ' ') { if (i > 0 && chars.find(compact_name[i - 1]) != std::string::npos) { compact_name.erase(i, 1); - } else if (i + 1 < compact_name.size() - && chars.find(compact_name[i + 1]) != std::string::npos) { + } else if (i + 1 < compact_name.size() && chars.find(compact_name[i + 1]) != std::string::npos) { compact_name.erase(i, 1); } } @@ -45,10 +44,10 @@ inline std::string RemoveInnerNamespace(const std::string &name) { std::string new_name = name; - auto iter = name.find("::__1"); - while (iter != std::string::npos) { - new_name.replace(iter, 5, ""); - iter = new_name.find("::__1"); + while (true) { + auto iter = name.find("::__1::"); + if (iter == std::string::npos) { break; } + new_name.replace(iter, 5, "::"); } return new_name; }