From 3d71a838ed2a1689dd329f964ec4d58152487151 Mon Sep 17 00:00:00 2001 From: Tsche Date: Fri, 14 Nov 2025 00:24:51 +0100 Subject: [PATCH] P1789R3 Library Support for Expansion Statements Fixes NB IT 002, FR 007-011, CZ 2-143, US 78-144 (C++26 CD). Editorial note: * The declarations of tuple_size and tuple_element are moved to after the "synopsis heading" under which their specializations are declared, similar to how this is presented elsewhere. --- source/meta.tex | 41 +++++++++++++++++++++++++++++++++++++++++ source/support.tex | 2 +- source/utilities.tex | 18 +++++++++++++++--- 3 files changed, 57 insertions(+), 4 deletions(-) diff --git a/source/meta.tex b/source/meta.tex index ab064f8f82..c738bac3a3 100644 --- a/source/meta.tex +++ b/source/meta.tex @@ -69,6 +69,47 @@ \end{note} \end{itemdescr} +\rSec2[intseq.binding]{Structured binding support} + +\indexlibraryglobal{tuple_size}% +\indexlibraryglobal{tuple_element}% +\begin{itemdecl} +template + struct tuple_size> + : integral_constant { }; + +template + struct tuple_element> { + using type = T; + }; +template + struct tuple_element> { + using type = T; + }; +\end{itemdecl} + +\begin{itemdescr} +\pnum +\mandates +$\tcode{I} < \tcode{sizeof...(Values)}$. +\end{itemdescr} + +\indexlibrarymember{get}{integer_sequence}% +\begin{itemdecl} +template + constexpr T get(integer_sequence) noexcept; +\end{itemdecl} + +\begin{itemdescr} +\pnum +\mandates +$\tcode{I} < \tcode{sizeof...(Values)}$. + +\pnum +\returns +\tcode{Values...[I]}. +\end{itemdescr} + \rSec1[type.traits]{Metaprogramming and type traits} \rSec2[type.traits.general]{General} diff --git a/source/support.tex b/source/support.tex index ab52a33fc9..d3bc607c20 100644 --- a/source/support.tex +++ b/source/support.tex @@ -728,7 +728,7 @@ // freestanding, also in \libheader{initializer_list} #define @\defnlibxname{cpp_lib_int_pow2}@ 202002L // freestanding, also in \libheader{bit} #define @\defnlibxname{cpp_lib_integer_comparison_functions}@ 202002L // freestanding, also in \libheader{utility} -#define @\defnlibxname{cpp_lib_integer_sequence}@ 201304L // freestanding, also in \libheader{utility} +#define @\defnlibxname{cpp_lib_integer_sequence}@ 202511L // freestanding, also in \libheader{utility} #define @\defnlibxname{cpp_lib_integral_constant_callable}@ 201304L // freestanding, also in \libheader{type_traits} #define @\defnlibxname{cpp_lib_interpolate}@ 201902L // also in \libheader{cmath}, \libheader{numeric} #define @\defnlibxname{cpp_lib_invoke}@ 201411L // freestanding, also in \libheader{functional} diff --git a/source/utilities.tex b/source/utilities.tex index d4a7d7587f..57e3f9e99c 100644 --- a/source/utilities.tex +++ b/source/utilities.tex @@ -114,6 +114,21 @@ template using index_sequence_for = make_index_sequence; + // \ref{intseq.binding}, structured binding support + template struct tuple_size; + template struct tuple_element; + + template + struct tuple_size>; + + template + struct tuple_element>; + template + struct tuple_element>; + + template + constexpr T get(integer_sequence) noexcept; + // \ref{pairs}, class template \tcode{pair} template struct pair; @@ -151,9 +166,6 @@ constexpr @\seebelow@ make_pair(T1&&, T2&&); // \ref{pair.astuple}, tuple-like access to pair - template struct tuple_size; - template struct tuple_element; - template struct tuple_size>; template struct tuple_element>;