feat!: add support for reflection #333
Merged
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.
Three commits here for three really huge c++26 features. Included corpus tests that pull most of the examples from the ISO papers themselves.
P2996: reflection
This adds support for all the language changes introduced in P2996 which
was recently voted into the upcoming c++26 standard.
This includes:
^^) followed byexpressions, type descriptors, or the global namespace (
::)[: expression :], which can appear as atype, expression, alias descriptor, and more.
constevalblocks: similar to static_asserts but have been introducedspecifically to allow constant evaluation side effects to occur at
specific places in code
P3394: annotations
Related to reflection, annotations use the same syntax as attributes,
but begin with an
=and support any constant expression. Annotationsand Attributes can't be mixed within [[ ... ]].
P1306: expansion statements
Introduces support for
template for ( init; for-range-decl : expansion-init )which is a compile-time way to expand (iterate over):
It was sufficient to simply re-use the existing rule for
_for_range_loop_body for the part inside the parentheses, but add the
required sequence of
templatefollowed byfor