Doc. no.: | P3794R0 |
Date: | 2025-7-13 |
Audience: | LEWG |
Reply-to: | Zhihao Yuan <zy@miator.net> |
An idea or two on renaming the nontype
tag
Background
C++26 editorially removed the terminology "non-type template parameter" while adopting P2841. P3740R1 followed up and discussed a few options to accommodate, including renaming the std::nontype
tag to std::constant_arg
.
Discussion
The name "nontype" was chosen not because it carries a non-type template argument, but because this name carries no meaning. f
is a non-type template argument, so nontype<f>
is calling your dog dog.
To convey some actual meaning, I suggest witness
, drawn from the term "witness table."
A term serving a similar role, and one that more C++ users recognize, is override
. However, the committee might want to reserve std::override
for more valuable purposes.
References
An idea or two on renaming the
nontype
tagBackground
C++26 editorially[1] removed the terminology "non-type template parameter" while adopting P2841[2]. P3740R1[3] followed up and discussed a few options to accommodate, including renaming the
std::nontype
tag tostd::constant_arg
.Discussion
The name "nontype" was chosen not because it carries a non-type template argument, but because this name carries no meaning.
f
is a non-type template argument, sonontype<f>
is calling your dog dog.To convey some actual meaning, I suggest
witness
, drawn from the term "witness table."[4]A term serving a similar role, and one that more C++ users recognize, is
override
. However, the committee might want to reservestd::override
for more valuable purposes.References
P2019R5 Rename non-type template parameter/argument to "constant". https://github.com/cplusplus/draft/pull/7587 ↩︎
P2841R7 Concept and variable-template template-parameters. https://wg21.link/p2841r7 ↩︎
P3740R1 Last chance to fix
std::nontype
. https://wg21.link/p3740r1 ↩︎Understanding Swift Performance. https://developer.apple.com/videos/play/wwdc2016/416/?time=1474 ↩︎