fork(1) download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. template <class CharType>
  5. void Foo(const std::basic_string<CharType> &s)
  6. {
  7. cout << s.c_str(); // TODO: Handle cout for wstring!!!
  8. }
  9.  
  10. void Foo(const char *s)
  11. {
  12. Foo((std::string)s);
  13. }
  14.  
  15. int main()
  16. {
  17. std::wstring mystr(L"hello");
  18. Foo(mystr);
  19.  
  20. Foo("world");
  21.  
  22. Foo(std::string("Im"));
  23.  
  24. Foo(std::basic_string<char>("so happy"));
  25.  
  26. return 0;
  27. }
Success #stdin #stdout 0s 3472KB
stdin
Standard input is empty
stdout
0x9f26014worldImso happy