std::tuple::swap
De cppreference.com
![]() |
Esta página se ha traducido por ordenador/computador/computadora de la versión en inglés de la Wiki usando Google Translate.
La traducción puede contener errores y palabras aparatosas/incorrectas. Planea sobre el texto para ver la versión original. Puedes ayudar a corregir los errores y mejorar la traducción. Para instrucciones haz clic aquí. |
Definido en el archivo de encabezado <tuple>
|
||
void swap( tuple& other ); |
(desde C++11) | |
std::swap llama para cada elemento en *this y su elemento correspondiente en
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.
Contenido |
[editar] Parámetros
other | - | tupla de valores a intercambiar
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
(Ninguno)
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] Excepciones
Especificación noexcept: (desde C++11)
noexcept( noexcept(swap(std::declval<T0&>>(), std::declval<T0&>())) && |
||
[editar] Ejemplo
Ejecuta este código
#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"; }
Salida:
(10, test, 3.14)