Skip to content
Open
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;
};
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't normally apply two-space indentation to definitions of classes. However, we're not consistent about that in general. There are definitions like struct nontype_t which are indented.

I don't think it needs to be fixed here, just something to keep in mind.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We seem to sometimes do that for short class definitions and empty classes (which would be the case for tuple_size directly above).

Currently tuple_element specializations for array, tuple and pair use 2-space indentation for the definition. Specializations for complex and ranges::subrange do not.

I've left it as is for now.

\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 @@ -725,7 +725,7 @@
#define @\defnlibxname{cpp_lib_inplace_vector}@ 202406L // also in \libheader{inplace_vector}
#define @\defnlibxname{cpp_lib_int_pow2}@ 202002L // freestanding, also in \libheader{bit}
#define @\defnlibxname{cpp_lib_integer_comparison_functions}@ 202002L // 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)>;

template<class T> struct tuple_size;
template<size_t I, class T> struct tuple_element;

// \ref{intseq.binding}, structured binding support
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