Espaces de noms
Variantes
Affichages
Actions

std::make_tuple

De cppreference.com
< cpp‎ | utility‎ | tuple

 
 
 
std::tuple
Les fonctions membres
Original:
Member functions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
tuple::tuple
tuple::operator=
tuple::swap
Tiers fonctions
Original:
Non-member functions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
make_tuple
tie
forward_as_tuple
None
operator=
operator!=
operator<
operator<=
operator>
operator>=
std::swap
get
Classes d'aide
Original:
Helper classes
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
tuple_size
tuple_element
uses_allocator
ignore
 
Defined in header <tuple>
template< class... Types >
tuple<VTypes...> make_tuple( Types&&... args );
(depuis C++11)

Creates a tuple object, deducing the target type from the types of arguments. The deduced types are std::decay<Ti>::type (transformed as if passed to a function by value) unless application of std::decay results in std::reference_wrapper<X> for some type X, in which case the deduced type is is X&.

[modifier] Paramètres

args -
zéro ou plusieurs arguments pour construire le tuple
Original:
zero or more arguments to construct the tuple from
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

[modifier] Retourne la valeur

A std::tuple object containing the given values.

[modifier] Exemple

#include <iostream>
#include <tuple>
#include <functional>
 
int main()
{
    auto t1 = std::make_tuple(10, "Test", 3.14);
    std::cout << "The value of t1 is "
              << "(" << std::get<0>(t1) << ", " << std::get<1>(t1)
              << ", " << std::get<2>(t1) << ")\n";
 
    int n = 1;
    auto t2 = std::make_tuple(std::ref(n), n);
    n = 7;
    std::cout << "The value of t2 is "
              << "(" << std::get<0>(t2) << ", " << std::get<1>(t2) << ")\n";
}

Résultat :

The value of t1 is (10, Test, 3.14)
The value of t2 is (7, 1)
crée un tuple de références lvalue ou décompresse un tuple dans des objets individuels
Original:
creates a tuple of lvalue references or unpacks a tuple into individual objects
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(fonction générique) [edit]
crée un tuple des références rvalue
Original:
creates a tuple of rvalue references
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(fonction générique) [edit]
crée un tuple en concaténant un certain nombre de tuples
Original:
creates a tuple by concatenating any number of tuples
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(fonction générique) [edit]