P3856R8 — New reflection metafunction - is_structural_type (US NB comment 49)
LWG
Several parts of the standard and library refer to structural types, including library mandates that types be structural, yet there is no way to query whether a type is structural. Library mandates clauses mean that library implementers must somehow have this functionality, but it is simply not exposed to users. We propose a new reflection metafunction - *is_structural_type(info)* as a solution, which would return *true* when *info* is the reflection of a structural type, and *false* otherwise. We also propose a corresponding type trait. The reflection metafunction is proposed to be added to the *<meta>* header, and the type trait to <type_traits>. We provide a sample implementation using other reflection metafunctions from P2996 to demonstrate how far we can go with the existing batch of reflection type queries included in C++26. In addition, we compare the approaches of using traditional type traits vs. using reflection metafunctions to query type attributes.