Skip to content

Commit ab87b86

Browse files
committed
added test case, readme update.
1 parent 422906a commit ab87b86

File tree

2 files changed

+30
-13
lines changed

2 files changed

+30
-13
lines changed

README.md

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22

33
**RTL** brings rich, type-safe run-time reflection to modern C++ — combining compile-time safety with run-time flexibility.
44

5-
🪞 What's “Reflection”?
5+
[![CMake](https://img.shields.io/badge/CMake-Enabled-brightgreen)](https://cmake.org) [![C++20](https://img.shields.io/badge/C++-20-blue)](https://isocpp.org) [![RTL Build](https://github.com/ReflectCxx/ReflectionTemplateLibrary-CPP/actions/workflows/build.yml/badge.svg?branch=release)](https://github.com/ReflectCxx/ReflectionTemplateLibrary-CPP/actions/workflows/build.yml?query=branch%3Arelease) [![License: MIT](https://img.shields.io/badge/License-MIT-green)](LICENSE)
6+
7+
### 🪞 What’s “Reflection”?
68

79
Reflection lets you interact with code by `name` instead of by `type`. Imagine you’ve written a simple function,
810
```c++
@@ -17,28 +19,23 @@ if(cToStr) { // Function materialized?
1719
std::string result = cToStr(61, 35); // Works! (int → float? No problem.)
1820
}
1921
```
20-
*No includes. No compile-time linking. No argument type-casting. No guess work.*
22+
*No includes. No compile-time linking. No argument type-casting. No guesswork.*
2123
*Just run-time lookup and type-safe invocation*.
2224

23-
⚡ Performance!
25+
### ⚡ Performance!
2426

25-
Overhead? Practically none. **RTL**'s reflective calls — when return and argument types are known — are just a native function-pointer hop, often faster than `std::function`.
27+
Overhead? Practically none. **RTL**s reflective calls — when return and argument types are known — are just a native function-pointer hop, often faster than `std::function`.
2628

2729
Yes — `rtl::function` is faster than `std::function`.
2830

2931
Microbenchmarks show reflective invocations through `rtl::function` have lower call overhead — a single, native pointer jump with no extra indirection.
3032
Once the functions start doing real work, both perform identically — always, under all conditions.
3133

32-
💡 In One Line
34+
### 💡 In One Line
3335

3436
***"RTL is a lightweight, static library that enables a robust, type-safe run-time reflection system for C++ — as flexible as in managed languages, yet as close as possible to native performance."***
3537

36-
[![CMake](https://img.shields.io/badge/CMake-Enabled-brightgreen)](https://cmake.org) [![C++20](https://img.shields.io/badge/C++-20-blue)](https://isocpp.org) [![RTL Build](https://github.com/ReflectCxx/ReflectionTemplateLibrary-CPP/actions/workflows/build.yml/badge.svg?branch=release)](https://github.com/ReflectCxx/ReflectionTemplateLibrary-CPP/actions/workflows/build.yml?query=branch%3Arelease) [![License: MIT](https://img.shields.io/badge/License-MIT-green)](LICENSE)
37-
38-
39-
## What RTL Brings to Your Code
40-
41-
* ***Runtime Reflection for C++*** – Introspect and manipulate objects dynamically, similar to Java or .NET, but with modern C++ idioms.
38+
## What’s more?
4239

4340
* ***Single Source of Truth*** – All metadata lives in one immutable `rtl::CxxMirror`, ensuring a consistent, thread-safe, duplication-free, and deterministic view of reflection data.
4441

@@ -63,7 +60,7 @@ Once the functions start doing real work, both perform identically — always, u
6360
```c++
6461
#include "RTLibInterface.h" // Reflection access interface.
6562
```
66-
Create an instance of `CxxMirror`, passing all type information directly to its constructor — and you're done!
63+
Create an instance of `CxxMirror`, passing all type information directly to its constructor — and youre done!
6764
```c++
6865
auto cxx_mirror = rtl::CxxMirror({
6966
/* ...register all types here... */
@@ -154,7 +151,7 @@ RTL doesn’t invent a new paradigm — it extends C++ itself. You create object
154151
***Perfect Forwarding** 🚀 – Binds LValue/RValue to correct overload.
155152
***Zero Overhead Forwarding** ⚡ – No temporaries or copies during method forwarding.
156153
***Namespace Support** 🗂️ – Group and reflect under namespaces.
157-
***Reflected Returns** 🔍 – Access return values whose types are unknown at compile time. Validate against the expected type and use them as if the type was known all along.
154+
***Reflected Returns** 🔍 – Access return values whose types are unknown at compile-time. Validate against the expected type and use them as if the type was known all along.
158155
***Smart Pointer Reflection** 🔗 – Reflect `std::shared_ptr` and `std::unique_ptr`, transparently access the underlying type, and benefit from automatic lifetime management with full sharing and cloning semantics.
159156
* 🟨 **Conservative Conversions** 🛡️ – Safely reinterpret reflected values without hidden costs. For example: treat an `int` as a `char`, or a `std::string` as a `std::string_view` / `const char*` — with no hidden copies and only safe, non-widening POD conversions. *(In Progress)*
160157
* 🟨 **Materialize New Types** 🔄 – Convert a reflected type `A` into type `B` if they are implicitly convertible. Define custom conversions at registration to make them available automatically. *(In Progress)*

RTLTestRunApp/src/FunctionalityTests/StaticTypeReflectiveCalls/StrictStaticTypeDispatch_StaticMethod.cpp

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,4 +181,24 @@ namespace rtl_tests
181181
EXPECT_EQ(ret_str, exp_str);
182182
}
183183
}
184+
185+
186+
TEST(StrictStaticTypeRtl_static_method, rvalue_ref_overload_resolution_with_known_signatures)
187+
{
188+
std::optional<rtl::Record> optStringUtil = cxx::mirror().getRecord(StringS::struct_);
189+
ASSERT_TRUE(optStringUtil);
190+
191+
std::optional<rtl::Method> reverseString = optStringUtil->getMethod(str_reverseString);
192+
ASSERT_TRUE(reverseString);
193+
{
194+
rtl::static_method<std::string(std::string&&)> reverse_string = reverseString.value()
195+
.argsT<std::string&&>()
196+
.returnT<std::string>();
197+
ASSERT_TRUE(reverse_string);
198+
199+
std::string ret_str = reverse_string(STRA);
200+
auto exp_str = std::string(STRA_REVERSE) + SUFFIX_std_string_rvref + SUFFIX_static;
201+
EXPECT_EQ(ret_str, exp_str);
202+
}
203+
}
184204
}

0 commit comments

Comments
 (0)