public member function
<tuple>
std::tuple::swapvoid swap (tuple& tpl) noexcept( /* see below */ );
Swap content
Exchanges the content of the tuple object by the content of tpl, which is another tuple of the same type (containing objects of the same types in the same order).This is done by calling swap (unqualified) on each pair of respective elements.
This member is only noexcept
if the swap function that operates between each of the element types is itself noexcept
.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
// tuple::swap
#include <iostream> // std::cout
#include <tuple> // std::tuple, std::get
int main ()
{
std::tuple<int,char> a (10,'x');
std::tuple<int,char> b (20,'y');
a.swap(b);
std::cout << "a contains: " << std::get<0>(a);
std::cout << " and " << std::get<1>(a) << '\n';
return 0;
}
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4