std::tuple::swap
Da 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. |
Definido no cabeçalho <tuple>
|
||
void swap( tuple& other ); |
(desde C++11) | |
Chama std::swap para cada elemento em *this e seu elemento correspondente em
other
.Original:
Calls std::swap for each element in *this and its corresponding element in
other
.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.
Índice |
[editar] Parâmetros
other | - | tupla de valores para trocar
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. |
[editar] Valor de retorno
(Nenhum)
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.
[editar] Exceções
noexcept specification: (desde C++11)
noexcept( noexcept(swap(std::declval<T0&>>(), std::declval<T0&>())) && |
||
[editar] Exemplo
#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"; }
Saída:
(10, test, 3.14)