From b6425fa20f850cc8e7cfb6d24fa67bb51975caf9 Mon Sep 17 00:00:00 2001 From: tqcq <99722391+tqcq@users.noreply.github.com> Date: Wed, 6 Mar 2024 09:01:30 +0800 Subject: [PATCH] feat update --- runtime/meta_utils.h | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) 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; }