[tuple.syn]

# 22 General utilities library [[utilities]](./#utilities)

## 22.4 Tuples [[tuple]](tuple#syn)

### 22.4.2 Header <tuple> synopsis [tuple.syn]

[ð](#header:%3ctuple%3e)

// all freestanding#include <compare> // see [[compare.syn]](compare.syn "17.12.1 Header <compare> synopsis")namespace std {// [[tuple.tuple]](tuple.tuple "22.4.4 Class template tuple"), class template tupletemplate<class... Types>class tuple; // [[tuple.like]](tuple.like "22.4.3 Concept tuple-like"), concept [*tuple-like*](tuple.like#concept:tuple-like "22.4.3 Concept tuple-like [tuple.like]")template<class T>concept [*tuple-like*](tuple.like#concept:tuple-like "22.4.3 Concept tuple-like [tuple.like]") = *see below*; // *exposition only*template<class T>concept [*pair-like*](#concept:pair-like "22.4.2 Header <tuple> synopsis [tuple.syn]") = // *exposition only*[*tuple-like*](tuple.like#concept:tuple-like "22.4.3 Concept tuple-like [tuple.like]")<T> && tuple_size_v<remove_cvref_t<T>> == 2; // [[tuple.common.ref]](tuple.common.ref "22.4.10 common_­reference related specializations"), common_reference related specializationstemplate<[*tuple-like*](tuple.like#concept:tuple-like "22.4.3 Concept tuple-like [tuple.like]") TTuple, [*tuple-like*](tuple.like#concept:tuple-like "22.4.3 Concept tuple-like [tuple.like]") UTuple, template<class> class TQual, template<class> class UQual>struct basic_common_reference<TTuple, UTuple, TQual, UQual>; template<[*tuple-like*](tuple.like#concept:tuple-like "22.4.3 Concept tuple-like [tuple.like]") TTuple, [*tuple-like*](tuple.like#concept:tuple-like "22.4.3 Concept tuple-like [tuple.like]") UTuple>struct common_type<TTuple, UTuple>; // ignorestruct *ignore-type* { // *exposition only*constexpr const *ignore-type*&operator=(const auto &) const noexcept { return *this; }}; inline constexpr *ignore-type* ignore; // [[tuple.creation]](tuple.creation "22.4.5 Tuple creation functions"), tuple creation functionstemplate<class... TTypes>constexpr tuple<unwrap_ref_decay_t<TTypes>...> make_tuple(TTypes&&...); template<class... TTypes>constexpr tuple<TTypes&&...> forward_as_tuple(TTypes&&...) noexcept; template<class... TTypes>constexpr tuple<TTypes&...> tie(TTypes&...) noexcept; template<[*tuple-like*](tuple.like#concept:tuple-like "22.4.3 Concept tuple-like [tuple.like]")... Tuples>constexpr tuple<CTypes...> tuple_cat(Tuples&&...); // [[tuple.apply]](tuple.apply "22.4.6 Calling a function with a tuple of arguments"), calling a function with a tuple of argumentstemplate<class F, [*tuple-like*](tuple.like#concept:tuple-like "22.4.3 Concept tuple-like [tuple.like]") Tuple>constexpr apply_result_t<F, Tuple> apply(F&& f, Tuple&& t)noexcept(is_nothrow_applicable_v<F, Tuple>); template<class T, [*tuple-like*](tuple.like#concept:tuple-like "22.4.3 Concept tuple-like [tuple.like]") Tuple>constexpr T make_from_tuple(Tuple&& t); // [[tuple.helper]](tuple.helper "22.4.7 Tuple helper classes"), tuple helper classestemplate<class T> struct tuple_size; // *not defined*template<class T> struct tuple_size<const T>; template<class... Types> struct tuple_size<tuple<Types...>>; template<size_t I, class T> struct tuple_element; // *not defined*template<size_t I, class T> struct tuple_element<I, const T>; template<size_t I, class... Types>struct tuple_element<I, tuple<Types...>>; template<size_t I, class T>using [tuple_element_t](#lib:tuple_element_t "22.4.2 Header <tuple> synopsis [tuple.syn]") = typename tuple_element<I, T>::type; // [[tuple.elem]](tuple.elem "22.4.8 Element access"), element accesstemplate<size_t I, class... Types>constexpr tuple_element_t<I, tuple<Types...>>& get(tuple<Types...>&) noexcept; template<size_t I, class... Types>constexpr tuple_element_t<I, tuple<Types...>>&& get(tuple<Types...>&&) noexcept; template<size_t I, class... Types>constexpr const tuple_element_t<I, tuple<Types...>>& get(const tuple<Types...>&) noexcept; template<size_t I, class... Types>constexpr const tuple_element_t<I, tuple<Types...>>&& get(const tuple<Types...>&&) noexcept; template<class T, class... Types>constexpr T& get(tuple<Types...>& t) noexcept; template<class T, class... Types>constexpr T&& get(tuple<Types...>&& t) noexcept; template<class T, class... Types>constexpr const T& get(const tuple<Types...>& t) noexcept; template<class T, class... Types>constexpr const T&& get(const tuple<Types...>&& t) noexcept; // [[tuple.rel]](tuple.rel "22.4.9 Relational operators"), relational operatorstemplate<class... TTypes, class... UTypes>constexpr bool operator==(const tuple<TTypes...>&, const tuple<UTypes...>&); template<class... TTypes, [*tuple-like*](tuple.like#concept:tuple-like "22.4.3 Concept tuple-like [tuple.like]") UTuple>constexpr bool operator==(const tuple<TTypes...>&, const UTuple&); template<class... TTypes, class... UTypes>constexpr common_comparison_category_t<*synth-three-way-result*<TTypes, UTypes>...>operator<=>(const tuple<TTypes...>&, const tuple<UTypes...>&); template<class... TTypes, [*tuple-like*](tuple.like#concept:tuple-like "22.4.3 Concept tuple-like [tuple.like]") UTuple>constexpr *see below* operator<=>(const tuple<TTypes...>&, const UTuple&); // [[tuple.traits]](tuple.traits "22.4.11 Tuple traits"), allocator-related traitstemplate<class... Types, class Alloc>struct uses_allocator<tuple<Types...>, Alloc>; // [[tuple.special]](tuple.special "22.4.12 Tuple specialized algorithms"), specialized algorithmstemplate<class... Types>constexpr void swap(tuple<Types...>& x, tuple<Types...>& y) noexcept(*see below*); template<class... Types>constexpr void swap(const tuple<Types...>& x, const tuple<Types...>& y) noexcept(*see below*); // [[tuple.helper]](tuple.helper "22.4.7 Tuple helper classes"), tuple helper classestemplate<class T>constexpr size_t [tuple_size_v](#lib:tuple_size_v "22.4.2 Header <tuple> synopsis [tuple.syn]") = tuple_size<T>::value;}
