fork(1) download
  1. #include <string>
  2. #include <iostream>
  3.  
  4. using namespace std;
  5.  
  6. template<size_t symbols_count> auto
  7. foo(const char (& sz_text)[symbols_count]) -> void { cout << 0; }
  8.  
  9. auto
  10. foo(char const * & psz_text) -> void { cout << 1; }
  11.  
  12. auto
  13. foo(char const * && psz_text) -> void { cout << 2; }
  14.  
  15. int main()
  16. {
  17. foo("qqq"); // вызовет (0)
  18. const char sz_text[] = {"www"};
  19. foo(sz_text); // вызовет (0)
  20. char const * psz_text("eee");
  21. foo(psz_text); // вызовет (1)
  22. ::std::string text("rrr");
  23. foo(text.c_str()); // // вызовет (2)
  24. return 0;
  25. }
Success #stdin #stdout 0s 3272KB
stdin
Standard input is empty
stdout
2212