Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
move swap
Language:
Ada
Assembly
Bash
C#
C++ (gcc)
C++ (clang)
C++ (vc++)
C (gcc)
C (clang)
C (vc)
Client Side
Clojure
Common Lisp
D
Elixir
Erlang
F#
Fortran
Go
Haskell
Java
Javascript
Kotlin
Lua
MySql
Node.js
Ocaml
Octave
Objective-C
Oracle
Pascal
Perl
Php
PostgreSQL
Prolog
Python
Python 3
R
Rust
Ruby
Scala
Scheme
Sql Server
Swift
Tcl
Visual Basic
Layout:
Vertical
Horizontal
#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; }
cl.exe
Show compiler warnings
[
+
] Compiler args
[
+
]
Show input
Compilation time: 1,8 sec, absolute running time: 1,42 sec, absolute service time: 3,22 sec
edit mode
|
history
|
discussion