|
2 | 2 |
|
3 | 3 | **Reflection Template Library (RTL)** brings rich runtime reflection to modern C++ — combining compile-time safety with runtime flexibility. |
4 | 4 |
|
5 | | -🪞 What is “Reflection”? — Reflection lets you intract with code *by name* instead of *by type*. |
6 | | -Imagine you’ve written a simple function, |
| 5 | +🪞 What's “Reflection” ? |
| 6 | +Reflection lets you interact with code by `name` instead of by `type`. Imagine you’ve written a simple function, |
7 | 7 | ```c++ |
8 | 8 | std::string GetAsString(int num); |
9 | 9 | ``` |
10 | 10 | **RTL** lets you call it dynamically: |
11 | 11 | ```c++ |
12 | | -rtl::function<std::string(int)> toStr = cxx_mirror.getFunction("GetAsString") //cxx_mirror?? see quick-preview! |
| 12 | +rtl::function<std::string(int)> toStr = cxx_mirror.getFunction("GetAsString") // cxx_mirror?? see quick preview! |
13 | 13 | ->argsT<int>() |
14 | 14 | .returnT<std::string>(); |
15 | | -std::string result = toStr(69375); // Works! |
| 15 | +if(toStr) { // All's well? |
| 16 | + std::string result = toStr(69375); // Works! |
| 17 | +} |
16 | 18 | ``` |
17 | | -**No includes | No compile-time type knowledge | Just runtime lookup & type-safe invocation**. |
| 19 | +**No includes. No compile-time linking. Just run-time lookup & type-safe invocation**. |
18 | 20 |
|
19 | | -⚡ Performance? Overhead? Practically none. |
20 | | -This RTL reflective call is just a native function pointer hop — faster than `std::function`. Yes! `rtl::function` is faster than `std::function`. |
| 21 | +⚡ Performance! |
| 22 | +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`. |
| 23 | +Yes! `rtl::function` is faster than `std::function`. |
21 | 24 |
|
22 | 25 | RTL performs reflective invocations — for free functions, methods, constructors — at near-zero cost, even when types are unknown at compile time. |
23 | 26 |
|
24 | 27 | 💡 In One Line |
25 | | - |
26 | 28 | ***RTL is a lightweight, static library that enables a robust, type-safe runtime reflection system for C++ — as flexible as in managed languages, yet as close as possible to native performance.*** |
27 | 29 |
|
28 | 30 | [](https://cmake.org) [](https://isocpp.org) [](https://github.com/ReflectCxx/ReflectionTemplateLibrary-CPP/actions/workflows/build.yml?query=branch%3Arelease) [](LICENSE) |
|
0 commit comments