Skip to content

Instantly share code, notes, and snippets.

@muaddib1971
Last active March 25, 2017 01:08
Show Gist options
  • Select an option

  • Save muaddib1971/3a45f5ff3a4d409c21243c5ebeb176ed to your computer and use it in GitHub Desktop.

Select an option

Save muaddib1971/3a45f5ff3a4d409c21243c5ebeb176ed to your computer and use it in GitHub Desktop.
An example of moving from a const reference and what that does to the original variable
#include <string>
#include <iostream>
#include <cstdlib>
void moveit(std::string& s)
{
std::string mys = std::move(s);
}
int main(void)
{
std::string s = "hi";
std::cout << s << std::endl;
moveit(s);
std::cout << "after move"<<std::endl;
std::cout << s << std::endl;
return EXIT_SUCCESS;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment