From 1e6bf03387f012e3d954a3adf7de8e56da1bce49 Mon Sep 17 00:00:00 2001 From: Patrick Urbanke Date: Sun, 3 Mar 2024 17:13:15 +0100 Subject: [PATCH] Minor bugfix in get_type_name --- include/rfl/internal/get_type_name.hpp | 11 +++++++++-- include/rfl/parsing/Parser_default.hpp | 2 ++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/include/rfl/internal/get_type_name.hpp b/include/rfl/internal/get_type_name.hpp index a35aa8a8..c1b61a03 100644 --- a/include/rfl/internal/get_type_name.hpp +++ b/include/rfl/internal/get_type_name.hpp @@ -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 consteval auto get_type_name() { + static_assert(get_type_name_str_view() == "int", + "Expected 'int', got something else."); constexpr auto name = get_type_name_str_view(); const auto to_str_lit = [&](std::index_sequence) { return StringLiteral{name[Ns]...}; diff --git a/include/rfl/parsing/Parser_default.hpp b/include/rfl/parsing/Parser_default.hpp index 81928fe9..19cce0d8 100644 --- a/include/rfl/parsing/Parser_default.hpp +++ b/include/rfl/parsing/Parser_default.hpp @@ -30,6 +30,7 @@ namespace parsing { template requires AreReaderAndWriter struct Parser { + public: using InputVarType = typename R::InputVarType; using OutputVarType = typename W::OutputVarType; @@ -159,6 +160,7 @@ struct Parser { } } + private: template static schema::Type make_description( std::map* _definitions) {