You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Reflection lets you interact with code by `name` instead of by `type`. Imagine you’ve written a simple function,
8
10
```c++
@@ -17,28 +19,23 @@ if(cToStr) { // Function materialized?
17
19
std::string result = cToStr(61, 35); // Works! (int → float? No problem.)
18
20
}
19
21
```
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.*
21
23
*Just run-time lookup and type-safe invocation*.
22
24
23
-
⚡ Performance!
25
+
### ⚡ Performance!
24
26
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`.
26
28
27
29
Yes — `rtl::function` is faster than `std::function`.
28
30
29
31
Microbenchmarks show reflective invocations through `rtl::function` have lower call overhead — a single, native pointer jump with no extra indirection.
30
32
Once the functions start doing real work, both perform identically — always, under all conditions.
31
33
32
-
💡 In One Line
34
+
### 💡 In One Line
33
35
34
36
***"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."***
****Runtime Reflection for C++*** – Introspect and manipulate objects dynamically, similar to Java or .NET, but with modern C++ idioms.
38
+
## What’s more?
42
39
43
40
****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.
44
41
@@ -63,7 +60,7 @@ Once the functions start doing real work, both perform identically — always, u
* ✅ **Zero Overhead Forwarding** ⚡ – No temporaries or copies during method forwarding.
156
153
* ✅ **Namespace Support** 🗂️ – Group and reflect under namespaces.
157
-
* ✅ **Reflected Returns** 🔍 – Access return values whose types are unknown at compiletime. 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.
158
155
* ✅ **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.
159
156
* 🟨 **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)*
160
157
* 🟨 **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)*
0 commit comments