Skip to content

Commit

Permalink
format code
Browse files Browse the repository at this point in the history
  • Loading branch information
yangxingpping committed Feb 25, 2024
1 parent 2b6e7c9 commit 8fcbc2e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 15 deletions.
24 changes: 10 additions & 14 deletions include/ylt/util/function_name.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@
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 @@ -34,20 +33,17 @@ 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 "}
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 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
2 changes: 1 addition & 1 deletion src/coro_rpc/examples/base_examples/rpc_service.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ std::string hello_world() {
}

bool return_bool_hello_world() {
return true;
return true;
}

int A_add_B(int a, int b) {
Expand Down

0 comments on commit 8fcbc2e

Please sign in to comment.