Skip to content

Commit

Permalink
remove use namespace
Browse files Browse the repository at this point in the history
  • Loading branch information
yangxingpping committed Feb 25, 2024
1 parent 8fcbc2e commit ada7e9b
Showing 1 changed file with 12 additions and 14 deletions.
26 changes: 12 additions & 14 deletions include/ylt/util/function_name.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,9 @@

#include "magic_names.hpp"

using namespace std::string_view_literals;

template <size_t N>
constexpr std::string_view string_view_array_has(const std::array<std::string_view, N>& array, std::string_view value) {
constexpr std::string_view string_view_array_has(
const std::array<std::string_view, N>& array, std::string_view value) {
for (const auto& v : array) {
if (value.find(v) == 0)
return v;
Expand All @@ -32,18 +31,17 @@ constexpr std::string_view string_view_array_has(const std::array<std::string_vi
namespace coro_rpc {
template <auto func>
constexpr std::string_view get_func_name() {
constexpr std::array func_style_array {
std::string_view{"__cdecl "},
std::string_view{"__clrcall "},
std::string_view{"__stdcall "},
std::string_view{"__fastcall "},
std::string_view{"__thiscall "},
std::string_view{"__vectorcall "}
};
constexpr auto qualified_name = std::string_view{refvalue::qualified_name_of_v<func>};
constexpr auto func_style = string_view_array_has(func_style_array, qualified_name);
constexpr std::array func_style_array{
std::string_view{"__cdecl "}, std::string_view{"__clrcall "},
std::string_view{"__stdcall "}, std::string_view{"__fastcall "},
std::string_view{"__thiscall "}, std::string_view{"__vectorcall "}};
constexpr auto qualified_name =
std::string_view{refvalue::qualified_name_of_v<func>};
constexpr auto func_style =
string_view_array_has(func_style_array, qualified_name);
if constexpr (func_style.length() > 0) {
return std::string_view{qualified_name.data() + func_style.length(), qualified_name.length() - func_style.length()};
return std::string_view{qualified_name.data() + func_style.length(),
qualified_name.length() - func_style.length()};
}
return qualified_name;
};
Expand Down

0 comments on commit ada7e9b

Please sign in to comment.