Skip to content

Instantly share code, notes, and snippets.

@veer66
Last active May 4, 2017 03:10
Show Gist options
  • Save veer66/072856a31a3ef5fba47e2343b794c12a to your computer and use it in GitHub Desktop.
Save veer66/072856a31a3ef5fba47e2343b794c12a to your computer and use it in GitHub Desktop.
#include <string>
#include <memory>
#include <iostream>
int
main(int argc, char* argv[])
{
std::unique_ptr<std::string> s(new std::string("toto"));
std::unique_ptr<std::string> p = std::move(s);
std::cout << *(s.get()) << std::endl;
return 0;
}
// g++ -Wall -g -std=c++11 move.cxx
// g++ (Ubuntu 5.4.1-2ubuntu1~16.04) 5.4.1 20160904
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment