[tuple.tuple.general]

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

## 22.4 Tuples [[tuple]](tuple#tuple.general)

### 22.4.4 Class template tuple [[tuple.tuple]](tuple.tuple#general)

#### 22.4.4.1 General [tuple.tuple.general]

[ð](#lib:tuple)

namespace std {template<class... Types>class tuple {public:// [[tuple.cnstr]](tuple.cnstr "22.4.4.2 Construction"), tuple constructionconstexpr explicit(*see below*) tuple(); constexpr explicit(*see below*) tuple(const Types&...); // only if sizeof...(Types) >= 1template<class... UTypes>constexpr explicit(*see below*) tuple(UTypes&&...); // only if sizeof...(Types) >= 1 tuple(const tuple&) = default;
 tuple(tuple&&) = default; template<class... UTypes>constexpr explicit(*see below*) tuple(tuple<UTypes...>&); template<class... UTypes>constexpr explicit(*see below*) tuple(const tuple<UTypes...>&); template<class... UTypes>constexpr explicit(*see below*) tuple(tuple<UTypes...>&&); template<class... UTypes>constexpr explicit(*see below*) tuple(const tuple<UTypes...>&&); template<class U1, class U2>constexpr explicit(*see below*) tuple(pair<U1, U2>&); // only if sizeof...(Types) == 2template<class U1, class U2>constexpr explicit(*see below*) tuple(const pair<U1, U2>&); // only if sizeof...(Types) == 2template<class U1, class U2>constexpr explicit(*see below*) tuple(pair<U1, U2>&&); // only if sizeof...(Types) == 2template<class U1, class U2>constexpr explicit(*see below*) tuple(const pair<U1, U2>&&); // only if sizeof...(Types) == 2template<[*tuple-like*](tuple.like#concept:tuple-like "22.4.3 Concept tuple-like [tuple.like]") UTuple>constexpr explicit(*see below*) tuple(UTuple&&); // allocator-extended constructorstemplate<class Alloc>constexpr explicit(*see below*) tuple(allocator_arg_t, const Alloc& a); template<class Alloc>constexpr explicit(*see below*) tuple(allocator_arg_t, const Alloc& a, const Types&...); template<class Alloc, class... UTypes>constexpr explicit(*see below*) tuple(allocator_arg_t, const Alloc& a, UTypes&&...); template<class Alloc>constexpr tuple(allocator_arg_t, const Alloc& a, const tuple&); template<class Alloc>constexpr tuple(allocator_arg_t, const Alloc& a, tuple&&); template<class Alloc, class... UTypes>constexpr explicit(*see below*) tuple(allocator_arg_t, const Alloc& a, tuple<UTypes...>&); template<class Alloc, class... UTypes>constexpr explicit(*see below*) tuple(allocator_arg_t, const Alloc& a, const tuple<UTypes...>&); template<class Alloc, class... UTypes>constexpr explicit(*see below*) tuple(allocator_arg_t, const Alloc& a, tuple<UTypes...>&&); template<class Alloc, class... UTypes>constexpr explicit(*see below*) tuple(allocator_arg_t, const Alloc& a, const tuple<UTypes...>&&); template<class Alloc, class U1, class U2>constexpr explicit(*see below*) tuple(allocator_arg_t, const Alloc& a, pair<U1, U2>&); template<class Alloc, class U1, class U2>constexpr explicit(*see below*) tuple(allocator_arg_t, const Alloc& a, const pair<U1, U2>&); template<class Alloc, class U1, class U2>constexpr explicit(*see below*) tuple(allocator_arg_t, const Alloc& a, pair<U1, U2>&&); template<class Alloc, class U1, class U2>constexpr explicit(*see below*) tuple(allocator_arg_t, const Alloc& a, const pair<U1, U2>&&); template<class Alloc, [*tuple-like*](tuple.like#concept:tuple-like "22.4.3 Concept tuple-like [tuple.like]") UTuple>constexpr explicit(*see below*) tuple(allocator_arg_t, const Alloc& a, UTuple&&); // [[tuple.assign]](tuple.assign "22.4.4.3 Assignment"), tuple assignmentconstexpr tuple& operator=(const tuple&); constexpr const tuple& operator=(const tuple&) const; constexpr tuple& operator=(tuple&&) noexcept(*see below*); constexpr const tuple& operator=(tuple&&) const; template<class... UTypes>constexpr tuple& operator=(const tuple<UTypes...>&); template<class... UTypes>constexpr const tuple& operator=(const tuple<UTypes...>&) const; template<class... UTypes>constexpr tuple& operator=(tuple<UTypes...>&&); template<class... UTypes>constexpr const tuple& operator=(tuple<UTypes...>&&) const; template<class U1, class U2>constexpr tuple& operator=(const pair<U1, U2>&); // only if sizeof...(Types) == 2template<class U1, class U2>constexpr const tuple& operator=(const pair<U1, U2>&) const; // only if sizeof...(Types) == 2template<class U1, class U2>constexpr tuple& operator=(pair<U1, U2>&&); // only if sizeof...(Types) == 2template<class U1, class U2>constexpr const tuple& operator=(pair<U1, U2>&&) const; // only if sizeof...(Types) == 2template<[*tuple-like*](tuple.like#concept:tuple-like "22.4.3 Concept tuple-like [tuple.like]") UTuple>constexpr tuple& operator=(UTuple&&); template<[*tuple-like*](tuple.like#concept:tuple-like "22.4.3 Concept tuple-like [tuple.like]") UTuple>constexpr const tuple& operator=(UTuple&&) const; // [[tuple.swap]](tuple.swap "22.4.4.4 swap"), tuple swapconstexpr void swap(tuple&) noexcept(*see below*); constexpr void swap(const tuple&) const noexcept(*see below*); }; template<class... UTypes> tuple(UTypes...) -> tuple<UTypes...>; template<class T1, class T2> tuple(pair<T1, T2>) -> tuple<T1, T2>; template<class Alloc, class... UTypes> tuple(allocator_arg_t, Alloc, UTypes...) -> tuple<UTypes...>; template<class Alloc, class T1, class T2> tuple(allocator_arg_t, Alloc, pair<T1, T2>) -> tuple<T1, T2>; template<class Alloc, class... UTypes> tuple(allocator_arg_t, Alloc, tuple<UTypes...>) -> tuple<UTypes...>;}

[1](#1)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/utilities.tex#L1782)

If a program declares an explicit or partial specialization of tuple,
the program is ill-formed, no diagnostic required[.](#1.sentence-1)
