Skip to content

Instantly share code, notes, and snippets.

@Kobzol
Created October 10, 2016 21:57
Show Gist options
  • Select an option

  • Save Kobzol/36358211c2927e9405be2fb6231b5366 to your computer and use it in GitHub Desktop.

Select an option

Save Kobzol/36358211c2927e9405be2fb6231b5366 to your computer and use it in GitHub Desktop.
wtf
#include <iostream>
class A
{
public:
void fn() & {
std::cout << "A" << std::endl;
}
void fn() && {
std::cout << "B" << std::endl;
}
};
A getA()
{
return A();
}
int main(int argc, const char **argv)
{
A a;
a.fn();
getA().fn();
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment