pfr_non_boost
Boost.PFR without the boost namespaces (by apolukhin)
pfr
std::tuple like methods for user defined types without any macro or boilerplate code (by boostorg)
| pfr_non_boost | pfr | |
|---|---|---|
| 1 | 4 | |
| 79 | 1,477 | |
| - | 0.3% | |
| 4.7 | 6.9 | |
| 12 months ago | 4 days ago | |
| C++ | C++ | |
| gtkbook License | gtkbook License |
The number of mentions indicates the total number of mentions that we've tracked plus the number of user suggested alternatives.
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
pfr_non_boost
Posts with mentions or reviews of pfr_non_boost.
We have used some of these posts to build our list of alternatives
and similar projects. The last one was on 2022-05-02.
-
Ask HN: Learn C++11 or Rust in 2022?
Here it's possible to serialize/deserialize this structure in a generic way without having to annotate it - currently it's a bit complicated to implement so libraries help doing it (e.g.https://github.com/apolukhin/pfr_non_boost) but in 23 the missing language feature that makes the code trivial to write without any library should be there.
pfr
Posts with mentions or reviews of pfr.
We have used some of these posts to build our list of alternatives
and similar projects. The last one was on 2022-03-23.
-
Rooting for P1061 "Structured Bindings can introduce a Pack"
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.
-
Minimum viable declarative GUI in C++
The code is relatively short and can be groked with a few coffees: https://github.com/boostorg/pfr/tree/develop/include/boost/pfr ; if you're using C++17 it uses a binary search (https://github.com/boostorg/pfr/blob/develop/include/boost/pfr/detail/fields_count.hpp) to count the number of fields in a struct, by starting by the observation that a likely majorant on the number of fields in a struct is sizeof(the struct) * CHAR_BIT, assuming not too many [[no_unique_address]] tomfooleries. Then once this count is known it's possible to simply map them as a tuple through sheer brute force and destructuring: https://github.com/boostorg/pfr/blob/develop/include/boost/pfr/detail/core17_generated.hpp
-
The Serde Rust Framework
I wonder if the c++ approach of boost.pfr would be portable to rust ? It allows reflection on aggregates without needing to annotate anything: https://github.com/boostorg/pfr
-
Counting the number of fields in an aggregate in C++20
It is an 'interesting' meta-programming problem though (wasted many weeks on it myself, fixed a small gcc bug - a 'uniform init' edge case and filed an issue with magic_get Reflecting array members of aggregate structs).
What are some alternatives?
When comparing pfr_non_boost and pfr you can also consider the following projects:
rttr - C++ Reflection Library
magic_get - std::tuple like methods for user defined types without any macro or boilerplate code
modern-cpp-features - A cheatsheet of modern C++ language and library features.
manifold - Manifold is a Java compiler plugin, its features include Metaprogramming, Properties, Extension Methods, Operator Overloading, Templates, a Preprocessor, and more.
dmd - dmd D Programming Language compiler
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