Created
November 29, 2019 16:47
-
-
Save quiye/0918c8475fbc3995210f4eb71a3fffdb to your computer and use it in GitHub Desktop.
move
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <bits/stdc++.h> | |
using namespace std; | |
struct something { | |
~something() { | |
cout << "destructor" << endl; | |
} | |
}; | |
something&& f(something&& s) { | |
return move(s); | |
} | |
int main() { | |
something s{}; | |
auto&& a = f(move(s)); | |
} | |
// single destructor |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment