Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions content/miscellaneous-reflection-cleanup.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
## What It Does

P3795R2 is a cleanup and consistency proposal for the new C++26 reflection facilities. It does
not introduce major new reflection capabilities, but fills gaps and unifies APIs that were left
inconsistent after several reflection-related papers were adopted together.

- `std::meta::current_function()`
- `std::meta::current_class()`
- `std::meta::current_namespace()`
- `std::meta::is_applicable_type()`
- `std::meta::is_nothrow_applicable_type()`
- `std::meta::apply_result()`

## Why It Matters

- Determining the current class or namespace required indirect workarounds through
`access_context`.
- Some existing type traits had no reflection-time equivalents.
- Reflection error reporting was underspecified and inconsistent.

## Example

```cpp
#include <meta>
#include <print>

int main() {
std::println("{}", std::meta::identifier_of(std::meta::current_function())); // prints: main
}
```
7 changes: 7 additions & 0 deletions features_cpp26.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1675,3 +1675,10 @@ features:
paper: P3913
lib: true
support: [GCC 16]

- desc: "Miscellaneous Reflection Cleanup"
paper: P3795
summary: "Fills gaps in the reflection API, adding `current_function()`, `current_class()` and `current_namespace()`, among others."
lib: true
content: miscellaneous-reflection-cleanup.md
keywords: ["reflection"]
Loading