From 49d5306d548c623de686dc0fd8c0ffa72e28381b Mon Sep 17 00:00:00 2001 From: neeraj31285 Date: Tue, 6 Oct 2026 20:25:29 +0530 Subject: [PATCH 1/2] minor updates. --- README.md | 6 ++++-- ReflectionTemplateLib/rtl/inc/type_meta.h | 19 +++++++++++-------- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index c9d7f470..c9b7c462 100644 --- a/README.md +++ b/README.md @@ -32,10 +32,12 @@ if(cToStr) { // Functor valid? ## Design Highlights -* ***Zero-Overhead by Design*** – Reflection metadata is registered and resolved lazily. You only pay for what you actually use. - * ***Non-Intrusive & Macro-Free*** – No macros, base classes, or intrusive user-type annotations required. +* ***Lazy Reflection*** – Reflection metadata is registered and resolved lazily, so runtime costs are incurred only when reflection is used. + +* ***Zero Overhead Invocation*** – When argument and return types are fully specified, reflective calls reduce to a single function-pointer hop. + * ***Performance*** – Reflective calls are on par with `std::function`, and can be even faster when argument and return types are fully specified. See the [Performance Summary](docs/benchmark_summary.md) for benchmark details. diff --git a/ReflectionTemplateLib/rtl/inc/type_meta.h b/ReflectionTemplateLib/rtl/inc/type_meta.h index 86e0d213..c30b3534 100644 --- a/ReflectionTemplateLib/rtl/inc/type_meta.h +++ b/ReflectionTemplateLib/rtl/inc/type_meta.h @@ -26,6 +26,7 @@ namespace rtl type_meta(const type_meta&) = default; type_meta& operator=(type_meta&&) = default; type_meta& operator=(const type_meta&) = default; + const bool operator==(const type_meta& pOther) const; constexpr const bool is_void() const; constexpr const bool is_empty() const; @@ -42,6 +43,7 @@ namespace rtl constexpr const traits::uid_t get_normal_args_id() const; constexpr const traits::uid_t get_strict_args_id() const; + template static type_meta add_function(return_t(*p_fptr)(signature_t...), traits::uid_t p_record_uid, detail::member p_member_kind); @@ -55,14 +57,6 @@ namespace rtl template static type_meta add_constructor(); - const bool operator==(const type_meta& pOther) const { - return (!is_empty() && !pOther.is_empty() && - get_functor().m_return_id == pOther.get_functor().m_return_id && - get_functor().m_record_id == pOther.get_functor().m_record_id && - get_functor().m_strict_args_id == pOther.get_functor().m_strict_args_id && - get_functor().m_member_kind == pOther.get_functor().m_member_kind); - } - private: using functor_t = std::optional>; @@ -119,4 +113,13 @@ namespace rtl constexpr const std::vector& type_meta::get_args_id_arr() const { return m_functor->get().m_args_type_ids; } + + inline const bool type_meta::operator==(const type_meta& pOther) const + { + return (!is_empty() && !pOther.is_empty() && + get_functor().m_return_id == pOther.get_functor().m_return_id && + get_functor().m_record_id == pOther.get_functor().m_record_id && + get_functor().m_strict_args_id == pOther.get_functor().m_strict_args_id && + get_functor().m_member_kind == pOther.get_functor().m_member_kind); + } } \ No newline at end of file From 3c56845dbe5b2c267c0e895c3e7d7e31ea1b3f02 Mon Sep 17 00:00:00 2001 From: neeraj31285 Date: Tue, 6 Oct 2026 20:28:35 +0530 Subject: [PATCH 2/2] minor update. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index c9b7c462..e52744bc 100644 --- a/README.md +++ b/README.md @@ -34,7 +34,7 @@ if(cToStr) { // Functor valid? * ***Non-Intrusive & Macro-Free*** – No macros, base classes, or intrusive user-type annotations required. -* ***Lazy Reflection*** – Reflection metadata is registered and resolved lazily, so runtime costs are incurred only when reflection is used. +* ***Pay for What You Use*** – Reflection metadata is registered and resolved lazily, so runtime costs are incurred only when reflection is used. * ***Zero Overhead Invocation*** – When argument and return types are fully specified, reflective calls reduce to a single function-pointer hop.