SaaSHub helps you find the best software and product alternatives Learn more →
Top 23 C++ Reflection Projects
-
Magic Enum C++
Static reflection for enums (to string, from string, iteration) for modern C++, work with any enum type without any macro or boilerplate code
-
InfluxDB
Power Real-Time Data Analytics at Scale. Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.
-
Nameof C++
Nameof operator for modern C++, simply obtain the name of a variable, type, function, macro, and enum
-
SaaSHub
SaaSHub - Software Alternatives and Reviews. SaaSHub helps you find the best software and product alternatives
-
refl-cpp
Static reflection for C++17 (compile-time enumeration, attributes, proxies, overloads, template functions, metaprogramming).
-
alpaca
Serialization library written in C++17 - Pack C++ structs into a compact byte-array without any macros or boilerplate code (by p-ranav)
-
SaaSHub
SaaSHub - Software Alternatives and Reviews. SaaSHub helps you find the best software and product alternatives
Project mention: Using Jolt with flecs & Dear ImGui: Game Physics Introspection | dev.to | 2024-04-17EnTT is a popular alternative to flecs for C++, which has different performance/memory characteristics.
Project mention: What C++ library do you wish existed but hasn’t been created yet? | /r/cpp | 2023-07-08I'm not sure this is quite what you're asking for, but this library has been super helpful to me in the past : https://github.com/Neargye/magic_enum
I really like better_enums instead of magic_enums. There’s no limit on enum size with it: http://aantron.github.io/better-enums/
It was heavily used at a former employer of mine, so definitely a solid production-ready solution.
This single feature opens a world of new possiblities. For example, it makes implementing "getting the number of fields" trivial. Furthrmore, and much more importantly, it enables turning a struct into a tuple. Currently, this can only be done by enumerating cases (therefore it's not fully generic), as with Boost PFR. By the way, PFR greatly simplifies our codebases, especially for parts with serialization and/or reflection.
Project mention: Out of bounds memory access in V8 in Google Chrome prior to 120.0.6099.224 | news.ycombinator.com | 2024-01-25You'd be surprised how much friction you'd have for C++ reflection. First, since it's a custom build step, you can do a mix of custom code gen and C++ constexpr/consteval for static reflection. Here's a header-only implementation for adding compile time reflection purely within the language [1]. And v8 already does dynamic code gen as part of its build process (to generate the snapshot to speedup instantiation of the isolate). Dynamic reflection is a must since JS is a dynamic language with reflection support.
Now of course, I don't know the specific details of reflection needed for the abstractions you reference and clearly V8 is still doing some amount of manual IR generation, so it's possible it would be a substantial investment to actually retrofit those techniques into v8. One would have to do a careful analysis of historical security exploits & specific techniques and their ability to prevent to figure out if it's worth adding those abstractions (especially since there is a potential performance tradeoff as you mention). As I said, I think there's insufficient research in this area to establish a compelling body of best practices (not to take away from the contributions of the GraalJS team to this space).
[1] https://github.com/veselink1/refl-cpp
C++ Reflection related posts
-
Out of bounds memory access in V8 in Google Chrome prior to 120.0.6099.224
-
Rooting for P1061 "Structured Bindings can introduce a Pack"
-
What C++ library do you wish existed but hasn’t been created yet?
-
A basic reflection-like system for editing object fields in a C++ game engine
-
enum_name (yet another enum to/from string conversion utility >=C++11)
-
what is the best API for serialization?
-
Behind the magic of magic_enum
-
A note from our sponsor - SaaSHub
www.saashub.com | 31 May 2024
Index
What are some of the best open-source Reflection projects in C++? This list will help you:
Project | Stars | |
---|---|---|
1 | entt | 9,577 |
2 | Magic Enum C++ | 4,492 |
3 | rttr | 3,009 |
4 | Nameof C++ | 1,982 |
5 | cista | 1,681 |
6 | Better Enums | 1,597 |
7 | pfr | 1,280 |
8 | refl-cpp | 1,015 |
9 | glaze | 927 |
10 | structopt | 450 |
11 | alpaca | 429 |
12 | avendish | 416 |
13 | Refureku | 199 |
14 | RareCpp | 116 |
15 | meta.hpp | 113 |
16 | serdepp | 99 |
17 | easy_reflection_cpp | 90 |
18 | metapp | 79 |
19 | pfr_non_boost | 59 |
20 | enum.hpp | 43 |
21 | enum_name | 19 |
22 | reflect | 14 |
23 | reflite | 9 |
Sponsored