diff --git a/content/miscellaneous-reflection-cleanup.md b/content/miscellaneous-reflection-cleanup.md new file mode 100644 index 0000000..07ae476 --- /dev/null +++ b/content/miscellaneous-reflection-cleanup.md @@ -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 +#include + +int main() { + std::println("{}", std::meta::identifier_of(std::meta::current_function())); // prints: main +} +``` diff --git a/features_cpp26.yaml b/features_cpp26.yaml index da01fdc..0ca6b67 100644 --- a/features_cpp26.yaml +++ b/features_cpp26.yaml @@ -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"]