mirror of
https://codeberg.org/DawnMagnet/reflect-cpp
synced 2026-12-03 00:26:19 +08:00
More elegant formulation
This commit is contained in:
@@ -52,10 +52,7 @@ consteval auto get_field_name_str_view() {
|
||||
#endif
|
||||
#if defined(__clang__)
|
||||
const auto split = func_name.substr(0, func_name.size() - 2);
|
||||
const auto possibly_prefixed = split.substr(split.find_last_of(".") + 1);
|
||||
const auto separator_index = possibly_prefixed.find_last_of(":");
|
||||
if (separator_index == std::string_view::npos) return possibly_prefixed;
|
||||
return possibly_prefixed.substr(separator_index + 1);
|
||||
return split.substr(split.find_last_of(":.") + 1);
|
||||
#elif defined(__GNUC__)
|
||||
const auto split = func_name.substr(0, func_name.size() - 2);
|
||||
return split.substr(split.find_last_of(":") + 1);
|
||||
|
||||
Reference in New Issue
Block a user