Run Code
|
API
|
Code Wall
|
Users
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Blog
move swap
#include <iostream> #include <utility> using namespace std; struct Foo { Foo() = default; Foo(const Foo &) { cout << "copy ctor" << endl; } Foo(Foo &&) { cout << "move ctor" << endl; } Foo &operator=(const Foo &) { cout << "copy =" << endl; return *this; } Foo &operator=(Foo &&) { cout << "move =" << endl; return *this; } }; int main() { Foo a, b; cout << "swap(a, b)" << endl; swap(a, b); cout << "swap(move(a), move(b))" << endl; swap(move(a), move(b)); return 0; }
run
|
edit
|
history
|
help
0
Please
log in
to post a comment.
students grade
MSVC14 <exception> header
Visual C++ template instantiation
constexpr internal error
Code
template test
Structured Member Value Access Using Structure Member Pointer and Variadic Templates
parantheses matching test 1
xxx
xyz1_1 programm
Please log in to post a comment.