Skip to content

Commit ba1eb5e

Browse files
committed
refactor util module: replace string_view with string, remove unused include, and add MSVC-specific prefix handling
1 parent 4537e9e commit ba1eb5e

2 files changed

Lines changed: 3 additions & 2 deletions

File tree

modules/core/util/include/util.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
#pragma once
22

3-
#include <algorithm>
43
#include <cstdint>
54
#include <cstdlib>
65
#include <memory>
@@ -61,6 +60,7 @@ std::string GetNamespace() {
6160
std::free};
6261
name = (status == 0) ? demangled.get() : name;
6362
#endif
63+
#if defined(_MSC_VER)
6464
const std::string prefixes[] = {"class ", "struct ", "enum ", "union "};
6565
for (const auto& prefix : prefixes) {
6666
if (name.starts_with(prefix)) {
@@ -69,6 +69,7 @@ std::string GetNamespace() {
6969
}
7070
}
7171
name.erase(0, name.find_first_not_of(' '));
72+
#endif
7273
auto pos = name.rfind("::");
7374
return (pos != std::string::npos) ? name.substr(0, pos) : std::string{};
7475
}

modules/core/util/tests/util.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#include <gtest/gtest.h>
44

55
#include <libenvpp/detail/get.hpp>
6-
#include <string_view>
6+
#include <string>
77

88
#include "omp.h"
99

0 commit comments

Comments
 (0)