experimental feature / proposal: C++26 reflection API ctre::reflect#361
Open
mishmish-dev wants to merge 2 commits into
Open
experimental feature / proposal: C++26 reflection API ctre::reflect#361mishmish-dev wants to merge 2 commits into
ctre::reflect#361mishmish-dev wants to merge 2 commits into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hi CTRE team!
While playing with reflection in GCC 16.1, I have created this module with
ctre::reflect::versions ofmatch,search(_all),starts_withandtokenizefunctors. They take an aggregate typeTas first template arg and fill its fields from positional / named groups on match (returningstd::optional<T>or range ofT).They are gated by a separate header include and
_cpp_lib_reflection >= 202603L.Godbolt example with single-header
ctre-reflect.hpp:https://godbolt.org/z/bfd1njGE8
See also
reflect.rstdoc and tests.I'm happy to discuss how does this fit into the grand scheme of things, the design and caveats. (E.g. the automatic convesion of captures to numeric fields is bit sketchy at the moment.)
Thanks for this awesome library!