fork(6) download
  1. #include <iostream>
  2. #include <sstream>
  3. #include <typeinfo>
  4. using namespace std;
  5.  
  6. #define UNICODE
  7.  
  8. namespace mine {
  9. #ifdef UNICODE
  10. using Char = wchar_t;
  11. #define Str(s) L##s
  12. #define UCOUT wcout
  13. #else
  14. using Char = char;
  15. #define Str(s) s
  16. #define UCOUT cout
  17. #endif
  18. using String = std::basic_string<Char>;
  19. using StringStream = std::basic_stringstream<Char>;
  20. }
  21.  
  22. int main() {
  23. mine::String s=Str("Hello");
  24. auto s2=s;
  25. cout << typeid(s2).name() <<endl;
  26. cout << typeid(s).name() <<endl;
  27. cout << typeid(string).name() <<endl;
  28. mine::StringStream sst{Str("Test")};
  29. sst<<Str(" ")<<s<<Str(" ")<<s2<<Str(" !!!")<<endl;
  30. // cout << sst.str()<<endl;
  31. UCOUT << sst.str()<<endl;
  32. return 0;
  33. }
Success #stdin #stdout 0s 3472KB
stdin
Standard input is empty
stdout
SbIwSt11char_traitsIwESaIwEE
SbIwSt11char_traitsIwESaIwEE
Ss
 Hello Hello !!!