Advertisement
Guest User

Untitled

a guest
Feb 19th, 2019
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.37 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. struct A {
  4.     void foo() & { std::cout << "l ref" << std::endl; }
  5.     void foo() const & { std::cout << "const l ref" << std::endl; }
  6.     void foo() && { std::cout << "r ref" << std::endl; }
  7. };
  8.  
  9. int main(int argc, char* argv[])
  10. {
  11.     (void)argc;
  12.     (void)argv;
  13.    
  14.     A l;
  15.     const A constl;
  16.  
  17.     l.foo();
  18.     constl.foo();
  19.     std::move(l).foo();
  20.  
  21.     return 0;
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement