fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. void f( const string &some )
  5. {
  6. cout << "c&" << some << "\n";
  7. }
  8.  
  9. void f( string &&some )
  10. {
  11. cout << "&&" << some << "\n";
  12. }
  13.  
  14. int main() {
  15. string s = "aaa";
  16. f( s );
  17. f( s + "bbb" );
  18. f( std::move( s ) );
  19. return 0;
  20. }
Success #stdin #stdout 0.01s 5436KB
stdin
Standard input is empty
stdout
c&aaa
&&aaabbb
&&aaa