fork download
  1. #include <iostream>
  2. #include <string>
  3. #include <vector>
  4.  
  5. /** /
  6. class UnicodeOne {
  7. public:
  8.  
  9. bool Parse(const std::uint8_t& High, const std::uint8_t& Mid,const std::uint8_t& Low) {
  10. std::uint16_t L = 0;
  11. std::uint8_t H = 0;
  12.  
  13. L = Low + (Mid << 8);
  14. }
  15.  
  16. protected:
  17. std::uint16_t Low = 0;
  18. std::uint8_t High = 0;
  19. };
  20. /**/
  21. int main() {
  22.  
  23. std::locale L("Japanese");
  24. std::locale l("", std::locale::ctype);
  25.  
  26. auto LR = std::wcout.imbue(l);
  27.  
  28. std::uint8_t S[] = u8"あ";
  29. std::uint8_t Z[4] = {};
  30.  
  31. Z[0] = S[1];
  32. Z[1] = S[0];
  33. Z[2] = S[2];
  34. Z[3] = S[3];
  35.  
  36. std::wcout << S << std::endl;
  37. std::wcout << Z << std::endl;
  38. std::wcout << u8"あ" << std::endl;
  39.  
  40. std::wcout.imbue(LR);
  41.  
  42. return 0;
  43.  
  44. }
Compilation error #stdin compilation error #stdout 0.01s 5516KB
stdin
Standard input is empty
compilation info
prog.cpp: In function ‘int main()’:
prog.cpp:24:38: error: no matching function for call to ‘std::locale::locale(const char [1], const category&)’
  std::locale l("", std::locale::ctype);
                                      ^
In file included from /usr/include/c++/8/bits/ios_base.h:41,
                 from /usr/include/c++/8/ios:42,
                 from /usr/include/c++/8/ostream:38,
                 from /usr/include/c++/8/iostream:39,
                 from prog.cpp:1:
/usr/include/c++/8/bits/locale_classes.h:340:5: note: candidate: ‘std::locale::locale(std::locale::_Impl*)’
     locale(_Impl*) throw();
     ^~~~~~
/usr/include/c++/8/bits/locale_classes.h:340:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/8/bits/locale_classes.h:206:7: note: candidate: ‘template<class _Facet> std::locale::locale(const std::locale&, _Facet*)’
       locale(const locale& __other, _Facet* __f);
       ^~~~~~
/usr/include/c++/8/bits/locale_classes.h:206:7: note:   template argument deduction/substitution failed:
prog.cpp:24:38: note:   mismatched types ‘_Facet*’ and ‘int’
  std::locale l("", std::locale::ctype);
                                      ^
In file included from /usr/include/c++/8/bits/ios_base.h:41,
                 from /usr/include/c++/8/ios:42,
                 from /usr/include/c++/8/ostream:38,
                 from /usr/include/c++/8/iostream:39,
                 from prog.cpp:1:
/usr/include/c++/8/bits/locale_classes.h:192:5: note: candidate: ‘std::locale::locale(const std::locale&, const std::locale&, std::locale::category)’
     locale(const locale& __base, const locale& __add, category __cat);
     ^~~~~~
/usr/include/c++/8/bits/locale_classes.h:192:5: note:   candidate expects 3 arguments, 2 provided
/usr/include/c++/8/bits/locale_classes.h:177:5: note: candidate: ‘std::locale::locale(const std::locale&, const string&, std::locale::category)’
     locale(const locale& __base, const std::string& __s, category __cat)
     ^~~~~~
/usr/include/c++/8/bits/locale_classes.h:177:5: note:   candidate expects 3 arguments, 2 provided
/usr/include/c++/8/bits/locale_classes.h:163:5: note: candidate: ‘std::locale::locale(const string&)’
     locale(const std::string& __s) : locale(__s.c_str()) { }
     ^~~~~~
/usr/include/c++/8/bits/locale_classes.h:163:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/8/bits/locale_classes.h:151:5: note: candidate: ‘std::locale::locale(const std::locale&, const char*, std::locale::category)’
     locale(const locale& __base, const char* __s, category __cat);
     ^~~~~~
/usr/include/c++/8/bits/locale_classes.h:151:5: note:   candidate expects 3 arguments, 2 provided
/usr/include/c++/8/bits/locale_classes.h:137:5: note: candidate: ‘std::locale::locale(const char*)’
     locale(const char* __s);
     ^~~~~~
/usr/include/c++/8/bits/locale_classes.h:137:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/8/bits/locale_classes.h:126:5: note: candidate: ‘std::locale::locale(const std::locale&)’
     locale(const locale& __other) throw();
     ^~~~~~
/usr/include/c++/8/bits/locale_classes.h:126:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/8/bits/locale_classes.h:117:5: note: candidate: ‘std::locale::locale()’
     locale() throw();
     ^~~~~~
/usr/include/c++/8/bits/locale_classes.h:117:5: note:   candidate expects 0 arguments, 2 provided
stdout
Standard output is empty