Namensräume
Varianten

std::tie

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

 
 
 
std::tuple
Member-Funktionen
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
Non-Member-Funktionen
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
Helper-Klassen
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
 
definiert in Header <tuple>
template<class... Types>
tuple<Types&...> tie( Types&... args);
(seit C++11)
Erstellt einen Tupel lvalue Verweise auf seine Argumente oder Instanzen von std::ignore .
Original:
Creates a tuple of lvalue references to its arguments or instances of std::ignore.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

Inhaltsverzeichnis

[Bearbeiten]Parameter

args -
null oder mehr lvalue Argumente, um die Tupel aus zu bauen
Original:
zero or more lvalue 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.

[Bearbeiten]Rückgabewert

A std::tuple Objekt mit lvalue referenes .
Original:
A std::tuple object containing lvalue referenes.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

[Bearbeiten]Ausnahmen

noexcept specification:  
noexcept
  (seit C++11)

[Bearbeiten]Beispiel

std::tie können verwendet werden, um die Einführung lexikographische Vergleich zu einer Struktur oder ein Tupel auszupacken werden:
Original:
std::tie can be used to introduce lexicographical comparison to a struct or to unpack a tuple:
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

#include <iostream>#include <string>#include <set>#include <tuple>   struct S {int n;std::string s;float d;bool operator<(const S& rhs)const{// compares n to rhs.n,// then s to rhs.s,// then d to rhs.dreturn std::tie(n, s, d)< std::tie(rhs.n, rhs.s, rhs.d);}};   int main(){std::set<S> set_of_s;// S is LessThanComparable   S value{42, "Test", 3.14};std::set<S>::iterator iter;bool inserted;// unpacks the return value of insert into iter and inserted std::tie(iter, inserted)= set_of_s.insert(value);if(inserted)std::cout<<"Value was inserted sucessfully\n";}

Output:

Value was inserted sucessfully
erzeugt eine tuple Objekt des Typs von den Argumenttypen definiert
Original:
creates a tuple object of the type defined by the argument types
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(Funktions-Template)[edit]
erzeugt ein tuple aus rvalue Referenzen
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.

(Funktions-Template)[edit]
erzeugt ein tuple durch Verketten einer beliebigen Anzahl von Tupeln
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.

(Funktions-Template)[edit]
Platzhalter, um ein Element zu überspringen, wenn Auspacken einer tuple mit tie
Original:
placeholder to skip an element when unpacking a tuple using tie
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(konstanten)[edit]
close