diff --git a/src/aether-miscpp/reflect/details/reflection.h b/src/aether-miscpp/reflect/details/reflection.h index 9b268d0..9e8799f 100644 --- a/src/aether-miscpp/reflect/details/reflection.h +++ b/src/aether-miscpp/reflect/details/reflection.h @@ -77,13 +77,14 @@ class Reflection { decltype(auto) Apply(F&& func) noexcept { if constexpr (mirror_type::kSize == 0) { return std::invoke(std::forward(func)); + } else { + return mirror.Apply([&](auto const&... meta) -> decltype(auto) { + return std::invoke( + std::forward(func), + meta.get(as_type::class_type>( + std::forward(obj)))...); + }); } - return mirror.Apply([&](auto const&... meta) -> decltype(auto) { - return std::invoke( - std::forward(func), - meta.get(as_type::class_type>( - std::forward(obj)))...); - }); } template decltype(auto) ApplyName(F&& func) noexcept { @@ -98,11 +99,12 @@ class Reflection { decltype(auto) ApplyMeta(F&& func) noexcept { if constexpr (mirror_type::kSize == 0) { return std::invoke(std::forward(func)); + } else { + return mirror.Apply([&](auto const&... meta) -> decltype(auto) { + return std::invoke(std::forward(func), std::forward(obj), + meta...); + }); } - return mirror.Apply([&](auto const&... meta) -> decltype(auto) { - return std::invoke(std::forward(func), std::forward(obj), - meta...); - }); } }; @@ -119,7 +121,7 @@ struct MakeReflection { } }; -static constexpr auto make_reflection = MakeReflection{}; +static constexpr inline auto make_reflection = MakeReflection{}; template concept Reflectable = requires(C c) {