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
Copy file name to clipboardExpand all lines: README.md
+13-15Lines changed: 13 additions & 15 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -44,9 +44,7 @@ if(cToStr) { // Function materialized?
44
44
45
45
****Non-Intrusive & Macro-Free*** – Reflection metadata is registered externally via a builder-style API, with no macros, base classes, or intrusive annotations required on user types.
46
46
47
-
****Zero-Overhead by Design*** – Metadata is registered and resolved lazily. Reflection introduces no runtime cost beyond the features explicitly exercised by the user.
48
-
49
-
****Deterministic Lifetimes*** – Automatic ownership tracking of `Heap` and `Stack` instances with zero hidden deep copies.
47
+
****Zero-Overhead by Design*** – Metadata can be registered and resolved lazily. Reflection introduces no runtime cost beyond the features explicitly exercised by the user.
50
48
51
49
****Cross-Compiler Consistency*** – Implemented entirely in standard C++20, with no compiler extensions or compiler-specific conditional behavior.
52
50
@@ -97,7 +95,7 @@ Lookup the `Person` class by its registered name –
`rtl::CxxMirror` provides two lookup APIs that return reflection metadata objects: `rtl::Record` for class/struct, and `rtl::Function` for non-member functions.
98
+
`rtl::CxxMirror` provides two lookup APIs that return reflection metadata objects: `rtl::Record` for any registered type (class, struct or pod), and `rtl::Function` for non-member functions.
101
99
102
100
From `rtl::Record`, registered member functions can be queried as `rtl::Method`. These are metadata descriptors (not callables) and are returned as `std::optional`, which will be empty if the requested entity is not found.
103
101
@@ -150,17 +148,17 @@ If the return type is also not known at compile time,`rtl::Return` can be used
auto [err, ret] = getName(robj)(); // Invoke and receive return value std::string wrapped in rtl::RObject.
151
+
auto [err, ret] = getName(robj)(); // Invoke and receive rtl::RObject as return, wrapping std::string underneath.
154
152
if (err == rtl::error::None && ret.canViewAs<std::string>()) {
155
153
const std::string& name = ret.view<std::string>()->get();
156
154
std::cout << name; // Safely view the returned std::string.
157
155
}
158
156
```
159
157
### How RTL Fits Together
160
158
161
-
At a high level, every registered C++ type is encapsulated as an `rtl::Record`. Callable entities (constructors, free functions, and member functions) are materialized through `rtl::Function`and `rtl::Method`, all of which are discoverable via `rtl::CxxMirror`.
159
+
At a high level, every registered C++ type is encapsulated as an `rtl::Record`. Callable entities (functions, member functions and constructors) are materialized through `rtl::Function`, `rtl::Method`and `rtl::Record`, all of which are discoverable via `rtl::CxxMirror`.
162
160
163
-
RTL provides the following callable wrappers, designed to be as lightweight and performant as `std::function` (and in many micro-benchmarks, faster when fully type-aware):
161
+
RTL provides the following callable entities, designed to be as lightweight and performant as `std::function` (and in many micro-benchmarks, faster when fully type-aware):
164
162
165
163
`rtl::function<>` – Free (non-member) functions
166
164
@@ -174,7 +172,7 @@ RTL provides the following callable wrappers, designed to be as lightweight and
174
172
175
173
These callable types are regular value types: they can be copied, moved, stored in standard containers, and passed around like any other lightweight object.
176
174
177
-
When invoked, only type-erased callables return an `rtl::error`, with results provided as `rtl::RObject` when both the return and target types are erased or as `std::optional<T>` when only the target type is erased, while fully type-aware callables return `T` directly with no error wrapper.
175
+
When invoked, only type-erased callables return an `rtl::error`, with results provided as `rtl::RObject` when both the return and target types are erased or as `std::optional<T>` when only the target type is erased, while fully type-aware callables return `T` directly with no error (by design).
178
176
179
177
### How to Build (Windows / Linux)
180
178
```sh
@@ -189,8 +187,8 @@ Run the generated binaries from `bin/`:
@@ -228,18 +226,18 @@ If you’re interested in advancing practical runtime reflection in C++ and supp
228
226
* Any overloaded method, Const/Non-Const based as well.
229
227
230
228
* ✅ **Perfect Forwarding** – Binds LValue/RValue to correct overload.
231
-
* ✅ **Zero Overhead Forwarding** – No temporaries or copies during method forwarding.
229
+
* ✅ **Zero Overhead Forwarding** – No temporaries or copies during dispatch and arguments forwarding.
232
230
* ✅ **Failure Semantics** – Explicit `rtl::error` diagnostics for all reflection operations (no exceptions, no silent failures).
233
231
* ✅ **Smart Pointer Reflection** – Reflect `std::shared_ptr` and `std::unique_ptr`, transparently access the underlying type, with full sharing and cloning semantics.
234
232
* 🟨 **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)*
235
-
* 🟨 **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)*
236
233
* 🚧 **STL Wrapper Support** – Extended support for wrappers like `std::optional` and `std::reference_wrapper`. Return them, forward them as parameters, and access wrapped entities transparently. *(In Progress)*
237
-
* 🚧 **Relaxed Argument Matching** – Flexible parameter matching for reflective calls, enabling intuitive conversions and overload resolution. *(In Progress)*
0 commit comments