Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions source/meta.tex
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,47 @@
\end{note}
\end{itemdescr}

\rSec2[intseq.binding]{Structured binding support}

\indexlibraryglobal{tuple_size}%
\indexlibraryglobal{tuple_element}%
\begin{itemdecl}
template<class T, T... Values>
struct tuple_size<integer_sequence<T, Values...>>
: integral_constant<size_t, sizeof...(Values)> { };

template<size_t I, class T, T... Values>
struct tuple_element<I, integer_sequence<T, Values...>> {
using type = T;
};
template<size_t I, class T, T... Values>
struct tuple_element<I, const integer_sequence<T, Values...>> {
using type = T;
};
\end{itemdecl}

\begin{itemdescr}
\pnum
\mandates
$\tcode{I} < \tcode{sizeof...(Values)}$.
\end{itemdescr}

\indexlibrarymember{get}{integer_sequence}%
\begin{itemdecl}
template<size_t I, class T, T... Values>
constexpr T get(integer_sequence<T, Values...>) 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}
Expand Down
2 changes: 1 addition & 1 deletion source/support.tex
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down
18 changes: 15 additions & 3 deletions source/utilities.tex
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,21 @@
template<class... T>
using index_sequence_for = make_index_sequence<sizeof...(T)>;

// \ref{intseq.binding}, structured binding support
template<class T> struct tuple_size;
template<size_t I, class T> struct tuple_element;

template<class T, T... Values>
struct tuple_size<integer_sequence<T, Values...>>;

template<size_t I, class T, T... Values>
struct tuple_element<I, integer_sequence<T, Values...>>;
template<size_t I, class T, T... Values>
struct tuple_element<I, const integer_sequence<T, Values...>>;

template<size_t I, class T, T... Values>
constexpr T get(integer_sequence<T, Values...>) noexcept;

// \ref{pairs}, class template \tcode{pair}
template<class T1, class T2>
struct pair;
Expand Down Expand Up @@ -151,9 +166,6 @@
constexpr @\seebelow@ make_pair(T1&&, T2&&);

// \ref{pair.astuple}, tuple-like access to pair
template<class T> struct tuple_size;
template<size_t I, class T> struct tuple_element;

template<class T1, class T2> struct tuple_size<pair<T1, T2>>;
template<size_t I, class T1, class T2> struct tuple_element<I, pair<T1, T2>>;

Expand Down