This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of C++20 status.
Section: 22.3.4 [pair.astuple], 22.6.4 [variant.helper] Status: C++20 Submitter: Agustín K-ballo Bergé Opened: 2017-06-10 Last modified: 2021-02-25
Priority: Not Prioritized
View all other issues in [pair.astuple].
View all issues with C++20 status.
Instantiating tuple_element with an out-of-bounds index requires a diagnostic for tuple and array, but not for pair. The specification requires an out-of-bounds index for pair to go to the base template instead, which is undefined.Similarly, instantiating variant_alternative with an out-of-bounds index violates a requirement, but it is not required to be diagnosed.
[2017-06-12, Moved to Tentatively Ready after 5 positive votes on c++std-lib]
This wording is relative to N4659.
Modify 22.2.1 [utility.syn], header <utility> synopsis, as indicated:
[…] // 22.3.4 [pair.astuple], tuple-like access to pair template <class T> class tuple_size; template <size_t I, class T> class tuple_element; template <class T1, class T2> struct tuple_size<pair<T1, T2>>;
template <class T1, class T2> struct tuple_element<0, pair<T1, T2>>; template <class T1, class T2> struct tuple_element<1, pair<T1, T2>>;[…]
Modify 22.3.4 [pair.astuple] as indicated:
tuple_element<0, pair<T1, T2>>::type
-1- Value: The type T1. tuple_element<1, pair<T1, T2>>::type
-2- Value: The type T2.
Modify 22.6.4 [variant.helper] as indicated:
-4- Requires: I < sizeof...(Types).-5- Value: The type TI.