2013/11/1 Incongruous <[email protected]>
> #include <string>
> #include <iostream>
>
> int main(){
> std::string s("string");
> std::cout << s << std::endl;
> std::u16string u16s(u"string");
> std::cout << u16s << std::endl;
> std::cin.get();
>
> return 0;
> }
>
> The above code gives me the following errors, am I using u16string
> correctly?
>
> Thanks in advance!!
>
Your code won't work anywhere. Why? Because C++ sucks ;-)
See here for rationale:
http://stackoverflow.com/a/6020835/256138
Ruben
>
>
>
> D:\Documents\dev\CodeBlocks\test1\main.cpp: In function 'int main()':
> D:\Documents\dev\CodeBlocks\test1\main.cpp:8:14: error: cannot bind
> 'std::ostream {aka std::basic_ostream<char>}' lvalue to
> 'std::basic_ostream<char>&&'
> std::cout << u16s << std::endl;
> ^
> In file included from
> c:\mingw64\lib\gcc\x86_64-w64-mingw32\4.8.1\include\c++\iostream:39:0,
> from D:\Documents\dev\CodeBlocks\test1\main.cpp:2:
> c:\mingw64\lib\gcc\x86_64-w64-mingw32\4.8.1\include\c++\ostream:602:5:
> error: initializing argument 1 of 'std::basic_ostream<_CharT, _Traits>&
> std::operator<<(std::basic_ostream<_CharT, _Traits>&&, const _Tp&) [with
> _CharT = char; _Traits = std::char_traits<char>; _Tp =
> std::basic_string<char16_t>]'
> operator<<(basic_ostream<_CharT, _Traits>&& __os, const _Tp& __x)
>
>
>
> ------------------------------------------------------------------------------
> Android is increasing in popularity, but the open development platform that
> developers love is also attractive to malware creators. Download this white
> paper to learn more about secure code signing practices that can help keep
> Android apps secure.
> http://pubads.g.doubleclick.net/gampad/clk?id=65839951&iu=/4140/ostg.clktrk
> _______________________________________________
> Mingw-w64-public mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
>
>
------------------------------------------------------------------------------
Android is increasing in popularity, but the open development platform that
developers love is also attractive to malware creators. Download this white
paper to learn more about secure code signing practices that can help keep
Android apps secure.
http://pubads.g.doubleclick.net/gampad/clk?id=65839951&iu=/4140/ostg.clktrk
_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public