Skip to content

experimental feature / proposal: C++26 reflection API ctre::reflect#361

Open
mishmish-dev wants to merge 2 commits into
hanickadot:mainfrom
mishmish-dev:reflect
Open

experimental feature / proposal: C++26 reflection API ctre::reflect#361
mishmish-dev wants to merge 2 commits into
hanickadot:mainfrom
mishmish-dev:reflect

Conversation

@mishmish-dev

Copy link
Copy Markdown
Contributor

Hi CTRE team!

While playing with reflection in GCC 16.1, I have created this module with ctre::reflect:: versions of match, search(_all), starts_with and tokenize functors. They take an aggregate type T as first template arg and fill its fields from positional / named groups on match (returning std::optional<T> or range of T).

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.rst doc 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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant