C++ Logo

std-proposals

Advanced search

[std-proposals] Type trait std::is_structural

From: Braden Ganetsky <braden.ganetsky_at_[hidden]>
Date: Fri, 25 Apr 2025 18:28:30 -0500
Hi all,

I haven't posted to this list before. I searched the archive to see if this
topic has been discussed here before, and I couldn't find anything.

In C++20 we can now take class types as non-type template parameters, as
long as it is a "structural type". In my own code, I've wanted to directly
check this property at compile-time. Preferably, I'd like to static_assert
this after the definition of my type, instead of it simply failing to work
in the NTTP.

Since "structural type" is defined in the standard (
https://eel.is/c++draft/temp.param#11) and not just a colloquial term, I
would like to see a trait that corresponds to this definition,
"std::is_structural". Would anyone else see value in this? Has this been
discussed before somewhere?

Thanks,
Braden

Received on 2025-04-25 23:28:43