std::tuple::swap
Aus cppreference.com
![]() |
This page has been machine-translated from the English version of the wiki using Google Translate.
The translation may contain errors and awkward wording. Hover over text to see the original version. You can help to fix errors and improve the translation. For instructions click here. |
definiert in Header <tuple>
|
||
void swap( tuple& other ); |
(seit C++11) | |
Ruft std::swap für jedes Element in *this und seinem entsprechenden Element im
other
.Original:
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
Inhaltsverzeichnis |
[Bearbeiten] Parameter
other | - | Tupel von Werten zu tauschen
Original: tuple of values to swap 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
(None)
Original:
(none)
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
[Bearbeiten] Ausnahmen
noexcept specification: (seit C++11)
noexcept( noexcept(swap(std::declval<T0&>>(), std::declval<T0&>())) && |
||
[Bearbeiten] Beispiel
#include <iostream> #include <tuple> #include <string> int main() { std::tuple<int, std::string, float> p1, p2; p1 = std::make_tuple(10, "test", 3.14); p2.swap(p1); std::cout << "(" << std::get<0>(p2) << ", " << std::get<1>(p2) << ", " << std::get<2>(p2) << ")\n"; }
Output:
(10, test, 3.14)