P3856R5 — New reflection metafunction - is_structural_type (US NB comment 49)
(7 items)
LEWG/LWG
This paper proposes adding a new reflection metafunction is_structural_type(info) to the header and a corresponding type trait is_structural to , allowing users to query whether a type is a structural type as defined in [temp.param]. The absence of such a facility is inconsistent with existing library mandates that require types to be structural, leaving users without a portable way to perform this check. A proof-of-concept implementation using P2996 reflection metafunctions is provided, demonstrating that the functionality can be approximated with existing reflection primitives while also highlighting gaps such as missing is_constexpr and is_literal_type metafunctions.
-
Section 3.1.1, first motivating example — template
declares V as a type, making decltype(V) and static constexpr auto value = V ill-formed; all three template heads in this block should use template . [1] -
Section 3.1.1, second motivating example (logging API) — template
declares Tag as a type, making decltype(Tag) ill-formed; should be template to match the stated intent of accepting NTTPs. [2] - Section 3.1.1, second motivating example (logging API) — Uses is_structural_type_v but the proposed variable template name throughout the paper and wording is is_structural_v. [1] [3]
- Section 5, Proposed Library wording — "structual" is misspelled; should be "structural". [2] [4]
- Table of contents / section headings — Section numbering skips 3.2; "3.3 Observations from the sample implementation" should be 3.2. [5]
- Section 8, References — Reference labeled [P2996R13] links to https://wg21.link/p2996r9 (revision R9), not R13. [6]
References — Anthropic Citations API
[1]
"template
requires is_structural_v
struct const_wrapper { static constexpr auto value = V; };"
"template
[2]
"template
requires is_structural_type_v
inline void log_event() { /* Tag is known to be NTTP */ }"
"template
[3]
chars 3532–3688
"template
requires is_structural_type_v
inline void log_event() { /* Tag is known to be NTTP */ }
// Fall back, run-time.
"
"template
[3]
chars 3532–3688
"template
requires is_structural_type_v
inline void log_event() { /* Tag is known to be NTTP */ }
// Fall back, run-time.
"
"template
[4]
chars 16480–18140
"21.4 Reflection [meta.reflection] 21.4.1 Header synopsis [meta.syn] … // associated with [meta.unary.prop], type properties ... consteval bool is_consteval_only_type(info type);..."
"21.4 Reflection [meta.reflection] 21.4.1 Header synopsis [meta.syn] … // associated with [meta.unary.prop], type properties ... consteval bool is_consteval_only_type(info type);..."
[4]
chars 16480–18140
"21.4 Reflection [meta.reflection] 21.4.1 Header synopsis [meta.syn] … // associated with [meta.unary.prop], type properties ... consteval bool is_consteval_only_type(info type);..."
"21.4 Reflection [meta.reflection] 21.4.1 Header synopsis [meta.syn] … // associated with [meta.unary.prop], type properties ... consteval bool is_consteval_only_type(info type);..."
[5]
"3.1.2 Proof of concept implementation 3.3 Observations from the sample implementation"
"3.1.2 Proof of concept implementation 3.3 Observations from the sample implementation"
[6]
"[P2996R13] Barry Revzin, Wyatt Childers, Peter Dimov, Andrew Sutton, Faisal Vali, Daveed Vandevoorde, Dan Katz. 2025-01-13. Reflection for C++26. https://wg21.link/p2996r9"
"[P2996R13] Barry Revzin, Wyatt Childers, Peter Dimov, Andrew Sutton, Faisal Vali, Daveed Vandevoorde, Dan Katz. 2025-01-13. Reflection for C++26. https://wg21.link/p2996r9"
Summary: P3856R5 proposes adding a reflection metafunction is_structural_v (and its type trait is_structural) to determine whether a type can be used as a non-type template parameter. It provides proposed wording for inclusion in the header and the [meta.unary.prop] table.
Pipeline: Discovery (Anthropic Opus + Citations API) → Verification Gate (OpenRouter Opus) → Report Writer (OpenRouter Opus)
Provenance: All references are machine-verified character positions from the Anthropic Citations API — deterministic, exact substrings, not model-generated quotes.
Provenance: All references are machine-verified character positions from the Anthropic Citations API — deterministic, exact substrings, not model-generated quotes.