Boost C++ Libraries: Ticket #9220: Allow using widechar along with narrowchar without creating separated streams https://svn.boost.org/trac10/ticket/9220 <p> It would be so nice to have a possibility to put wide-char objects along with narrow-char objects into Logging streams without creating separated versions like "logger"/"wlogger" for each type. </p> <p> If I use both types simultaneously, I mean std::string and std::wstring, and I want to report everything into my log-file then I have a mess. I need EITHER to create separate logging-objects for each type OR convert one type into another. </p> <p> For example, Google-test library allows mix wchar and char output for custom error message for ASSERT: </p> <pre class="wiki">ASSERT_TRUE(false) &lt;&lt; L"wide-message" &lt;&lt; "narrow-message"; ASSERT_FALSE(true) &lt;&lt; std::wstring(L"message") &lt;&lt; std::string("message"); </pre><p> And it is so convenient! </p> <p> Any stream operator overloading is not an option. If library claims to be convenient, it should not require some magic non-documented workarounds. </p> <p> Thanks! </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/9220 Trac 1.4.3 Andrey Semashev Thu, 10 Oct 2013 10:39:38 GMT status changed; resolution set https://svn.boost.org/trac10/ticket/9220#comment:1 https://svn.boost.org/trac10/ticket/9220#comment:1 <ul> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">fixed</span> </li> </ul> <p> You can just always use wlogger. Just don't forget to setup a proper locale in the sink so that wide characters are converted to narrow chars correctly when storing to files. </p> <p> You can also output wide strings to narrow loggers, but in this case you don't have the control over the locale in the stream. </p> Ticket