From 54469a88a5aa307f3ec80b43c428401b37b57898 Mon Sep 17 00:00:00 2001 From: Patrick Urbanke Date: Thu, 21 Dec 2023 23:24:11 +0100 Subject: [PATCH] Use old way of handling reflection types --- include/rfl/parsing/Parser_default.hpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/include/rfl/parsing/Parser_default.hpp b/include/rfl/parsing/Parser_default.hpp index 268ba979..5bc2bfe2 100644 --- a/include/rfl/parsing/Parser_default.hpp +++ b/include/rfl/parsing/Parser_default.hpp @@ -71,11 +71,15 @@ struct Parser { /// Converts the variable to a JSON type. static auto write(const W& _w, const T& _var) noexcept { if constexpr (supports_attributes && internal::is_attribute_v) { - const auto r = resolve_reflection_type(_var); - return _w.from_basic_type(r, true); + return _w.from_basic_type(resolve_reflection_type(_var), true); } else if constexpr (internal::has_reflection_type_v) { - const auto r = resolve_reflection_type(_var); - return Parser>::write(_w, r); + using ReflectionType = std::decay_t; + if constexpr (internal::has_reflection_method_v) { + return Parser::write(_w, _var.reflection()); + } else { + const auto& [r] = _var; + return Parser::write(_w, r); + } } else if constexpr (std::is_class_v && std::is_aggregate_v) { const auto ptr_named_tuple = internal::to_ptr_named_tuple(_var); using PtrNamedTupleType = std::decay_t;