[tuple.creation] # 22 General utilities library [[utilities]](./#utilities) ## 22.4 Tuples [[tuple]](tuple#creation) ### 22.4.5 Tuple creation functions [tuple.creation] [🔗](#lib:make_tuple) `template constexpr tuple...> make_tuple(TTypes&&... t); ` [1](#1) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/utilities.tex#L2579) *Returns*: tuple...>(std​::​forward(t)...)[.](#1.sentence-1) [2](#2) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/utilities.tex#L2583) [*Example [1](#example-1)*: int i; float j; make_tuple(1, ref(i), cref(j)); creates a tuple of type tuple[.](#2.sentence-1) — *end example*] [🔗](#lib:forward_as_tuple) `template constexpr tuple forward_as_tuple(TTypes&&... t) noexcept; ` [3](#3) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/utilities.tex#L2601) *Effects*: Constructs a tuple of references to the arguments in t suitable for forwarding as arguments to a function[.](#3.sentence-1) Because the result may contain references to temporary objects, a program shall ensure that the return value of this function does not outlive any of its arguments (e.g., the program should typically not store the result in a named variable)[.](#3.sentence-2) [4](#4) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/utilities.tex#L2609) *Returns*: tuple(std​::​forward(t)...)[.](#4.sentence-1) [🔗](#lib:tie) `template constexpr tuple tie(TTypes&... t) noexcept; ` [5](#5) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/utilities.tex#L2623) *Returns*: tuple(t...)[.](#5.sentence-1) [6](#6) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/utilities.tex#L2627) [*Example [2](#example-2)*: tie functions allow one to create tuples that unpack tuples into variables[.](#6.sentence-1) ignore can be used for elements that are not needed:int i; std::string s; tie(i, ignore, s) = make_tuple(42, 3.14, "C++");// i == 42, s == "C++" — *end example*] [🔗](#lib:tuple_cat) `template<[tuple-like](tuple.like#concept:tuple-like "22.4.3 Concept tuple-like [tuple.like]")... Tuples> constexpr tuple tuple_cat(Tuples&&... tpls); ` [7](#7) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/utilities.tex#L2647) Let n be sizeof...(Tuples)[.](#7.sentence-1) For every integer 0≤i[.](#7.2.sentence-1) - [(7.3)](#7.3) Let tpi be the ith element in the function parameter pack tpls[.](#7.3.sentence-1) - [(7.4)](#7.4) Let Si be tuple_size_v[.](#7.4.sentence-1) - [(7.5)](#7.5) Let Eki be tuple_element_t[.](#7.5.sentence-1) - [(7.6)](#7.6) Let eki be get(std​::​forward(tpi))[.](#7.6.sentence-1) - [(7.7)](#7.7) Let Elemsi be a pack of the types E0i,…,ESi−1i[.](#7.7.sentence-1) - [(7.8)](#7.8) Let elemsi be a pack of the expressions e0i,…,eSi−1i[.](#7.8.sentence-1) The types in CTypes are equal to the ordered sequence of the expanded packs of typesElems0..., Elems1..., …, Elemsn−1...[.](#7.sentence-3) Let celems be the ordered sequence of the expanded packs of expressionselems0..., …, elemsn−1...[.](#7.sentence-4) [8](#8) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/utilities.tex#L2676) *Mandates*: (is_constructible_v && ...) is true[.](#8.sentence-1) [9](#9) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/utilities.tex#L2680) *Returns*: tuple(celems...)[.](#9.sentence-1)