diff --git a/README.md b/README.md index ae1f217d..a4a710f2 100644 --- a/README.md +++ b/README.md @@ -32,11 +32,13 @@ 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. -* **Non-Intrusive & Macro-Free** – No macros, base classes, or intrusive user-type annotations required. +* ***Pay for What You Use*** – Reflection metadata is registered and resolved lazily, so runtime costs are incurred only when reflection is used. -* **Performance** – Reflective calls are on par with `std::function`, and can be even faster when argument and return types are fully specified. +* ***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