mirror of
https://codeberg.org/DawnMagnet/reflect-cpp
synced 2026-12-02 16:16:19 +08:00
Minor bugfix in get_type_name
This commit is contained in:
@@ -25,8 +25,13 @@ consteval auto get_type_name_str_view() {
|
||||
const auto split = func_name.substr(0, func_name.size() - 1);
|
||||
return split.substr(split.find("T = ") + 4);
|
||||
#elif defined(_MSC_VER)
|
||||
const auto split = func_name.substr(0, func_name.size() - 7);
|
||||
return split.substr(split.find("get_type_name_str_view<") + 23);
|
||||
auto split = func_name.substr(0, func_name.size() - 7);
|
||||
split = split.substr(split.find("get_type_name_str_view<") + 23);
|
||||
auto pos = split.find(" ");
|
||||
if (pos != std::string_view::npos) {
|
||||
return split.substr(pos + 1);
|
||||
}
|
||||
return split;
|
||||
#else
|
||||
static_assert(
|
||||
false,
|
||||
@@ -37,6 +42,8 @@ consteval auto get_type_name_str_view() {
|
||||
|
||||
template <class T>
|
||||
consteval auto get_type_name() {
|
||||
static_assert(get_type_name_str_view<int>() == "int",
|
||||
"Expected 'int', got something else.");
|
||||
constexpr auto name = get_type_name_str_view<T>();
|
||||
const auto to_str_lit = [&]<auto... Ns>(std::index_sequence<Ns...>) {
|
||||
return StringLiteral<sizeof...(Ns) + 1>{name[Ns]...};
|
||||
|
||||
@@ -30,6 +30,7 @@ namespace parsing {
|
||||
template <class R, class W, class T>
|
||||
requires AreReaderAndWriter<R, W, T>
|
||||
struct Parser {
|
||||
public:
|
||||
using InputVarType = typename R::InputVarType;
|
||||
using OutputVarType = typename W::OutputVarType;
|
||||
|
||||
@@ -159,6 +160,7 @@ struct Parser {
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
template <class U>
|
||||
static schema::Type make_description(
|
||||
std::map<std::string, schema::Type>* _definitions) {
|
||||
|
||||
Reference in New Issue
Block a user