std::tuple_size
Section: 22.4.7 [tuple.helper] Status: New Submitter: Jiang An Opened: 2024-01-20 Last modified: 2024-03-11
Priority: 3
View all other issues in [tuple.helper].
View all issues with New status.
Discussion:
22.4.7 [tuple.helper]/1 currently says:
All specializations of
tuple_size
meet the Cpp17UnaryTypeTrait requirements (21.3.2 [meta.rqmts]) with a base characteristic ofintegral_constant<size_t, N>
for someN
.
which is probably wrong for std::tuple_size<int>
and
std::tuple_size<std::vector<int>>
whose definitions are not provided, and
contradicts with 22.4.7 [tuple.helper]/4
[…] Otherwise, it has no member
value
.
Also, there's currently implementation divergence on whether std::tuple_size<cv T>
is a complete type when std::tuple_size<T>::value
is absent (related to LWG 2770).
Some implementations (e.g.
libc++
and libstdc++)
treat 22.4.7 [tuple.helper]/4 and D.15 [depr.tuple]/2 as "std::tuple_size<cv T>
is generated from partial specializations only if std::tuple_size<T>
meets the aforementioned conditions",
while others (e.g. MSVC STL)
always consider std::tuple_size<cv T>
needs to be defined. The latter
reading seems to be justified by 16.4.2.2 [contents]/1 and 22.4.2 [tuple.syn].
[2024-03-11; Reflector poll]
Set priority to 3 after reflector poll. The first part of the issue was fixed editorially.
Proposed resolution: