cppreference-doc
magic_get
Our great sponsors
cppreference-doc | magic_get | |
---|---|---|
7 | 9 | |
509 | 193 | |
- | - | |
2.1 | 8.2 | |
9 months ago | 5 months ago | |
HTML | C++ | |
GNU General Public License v3.0 only | Boost Software License 1.0 |
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.
cppreference-doc
-
Learn C++: An Introduction for Beginners
C++ reference websites, such as cplusplus.com and cppreference.com.
-
Is there any C++ tutorials that don't assume this is your first language?
A couple tips: * To look up info about the C++ language and standard libraries, cppreference is fantastic. * The godbolt compiler explorer is very cool for investigating "is this code legal" and "what assembly does this compile to" type questions.
-
What are some C++ specific antipatterns that might be missed by C#/Java devs?
Learn as much of the stl as possible (https://en.cppreference.com/)
-
Super unpopular opinion incoming.
Actually, en.cppreference.com/ is OK. I often lookup here every time I write C++.
-
furry📱irl
https://en.cppreference.com/ as a web app, i can never win, im never good enough
-
Using Java code that prints a star pattern to check the validity of birth certificates!
Why not just en.cppreference.com ?
- Does someone know why cppreference.com is currently so slow?
magic_get
-
What is a good way to iterate through struct contents?
Maybe this: https://github.com/apolukhin/magic_get
-
What information about a type/class can we get?
You can access non-static member variables with structured bindings. See for instance magic_get/boostPfr https://github.com/apolukhin/magic_get. Structured bindings will only bind to the accessible members (not private). Magic get works by by finding the number of member variables, converting the struct to a tuple (with a function that is specialized for the number of fields), and finally accessing the members through the tuple (supporting indexing and iteration). It does not grant access to the member names, but it is sufficient for some reflection.
-
A way to determine the number of elements in a structured binding
Libraries like magic_get expose the members of an aggregate class/struct to allow writing generic code for things like pretty printing and serialization without anything special done to the class itself. They often rely on structured bindings for the decomposition (*), but find the number of elements via SFINAE on aggregate initialization, as an aggregate type can be initialized only from as many objects as it has members. It would be nicer if you could SFINAE directly on the structured binding itself, as then the type could have user-defined constructors (which aggregates can't). Unfortunately, this is not possible since structured binding is a statement and not an expression. Unless you're using Clang, where the GNU statement expressions extension allows you to do SFINAE on them, as in here.
-
Minimum viable declarative GUI in C++
No RTTI required, but the types are required to be aggregates (no constructors defined). It's possible to count the number of members using SFINAE by trying different numbers of inputs to the aggregate constructor using a type that's castable to anything, and then enumerate the members with a similar trick (or use structured binding to pull them out directly). I think he uses magic_get which is the most popular library for this trick.
-
Call function on each member of struct using preprocessor
take a look at magic_get to get access to all struct members. No idea what your plan is with foo and the preprocessor though.
-
Serdepp 0.1.2 Released
Neat! Have you considered using magic_get?
-
Getting information about classes, methods and variables in C++?
It is possible with some hacks https://github.com/apolukhin/magic_get
- Struct bulk operations - Reflection? Code gen?
-
Reflecting Over Members of an Aggregate
I actually reference it near the bottom of the article under its original name, magic_get! I was disappointed to discover that this library did it a similar way first before me while researching 😅
What are some alternatives?
telescope-vimwiki.nvim - look through your vimwiki with your telescope
pfr - std::tuple like methods for user defined types without any macro or boilerplate code
CPython - The Python programming language
cling - The cling C++ interpreter
axios-docs - Official documentation for the axios HTTP library
cppreference-doc - C++ standard library reference
caniuse - Raw browser/feature support data from caniuse.com
serdepp - c++ serialize and deserialize adaptor library like rust serde.rs
amp-hal-st - HAL implementation of the Embedded Infrastructure Library for ST microcontrollers
cppinsights - C++ Insights - See your source code with the eyes of a compiler
stdrev - Script for cppreference, to control the amount of visible content
axios - Promise based HTTP client for the browser and node.js