public member function
<functional>
std::function::swapvoid swap (function& x) noexcept;
Swap targets
Exchanges the target callable object stored in the object by the one in x.1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
// function::swap example
#include <iostream> // std::cout
#include <functional> // std::function, std::plus
int main () {
std::function<int(int,int)> foo,bar;
foo = std::plus<int>();
foo.swap(bar);
std::cout << "foo is " << (foo ? "callable" : "not callable") << ".\n";
std::cout << "bar is " << (bar ? "callable" : "not callable") << ".\n";
return 0;
}
foo is not callable. bar is callable.
*this
and x are modified.
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