Skip to content

Instantly share code, notes, and snippets.

@quiye
Created November 29, 2019 16:47
Show Gist options
  • Save quiye/0918c8475fbc3995210f4eb71a3fffdb to your computer and use it in GitHub Desktop.
Save quiye/0918c8475fbc3995210f4eb71a3fffdb to your computer and use it in GitHub Desktop.
move
#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