feat update

This commit is contained in:
tqcq 2024-03-06 09:01:30 +08:00
parent cf664d8143
commit b6425fa20f

View File

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