[Bug libstdc++/60711] basic_ostringstream,basic_ostream,u16string,char16_t do not work together
jmichae3 at yahoo dot com
gcc-bugzilla@gcc.gnu.org
Sun Mar 30 19:30:00 GMT 2014
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60711
--- Comment #5 from Jim Michaels <jmichae3 at yahoo dot com> ---
not allowed to use a basic_streambuf there either, also says it's protected.
apparently ostream() is protected. I looked, and there is a place that looks
like you can use a treambuf, but I am unable to get it to work.
ostream line 384 where it says
protected:
basic_ostream()
{ this->init(0); }
template<typename _ValueT>
__ostream_type&
_M_insert(_ValueT __v);
};
is where it complains.
tried typedef std::basic_ostream<std::basic_streambuf<char16_t,
std::char_traits<char16_t> > > uostream;
and got
f:\x86_64-4.9.0-snapshot-20140219-rev207854-win32-sjlj-rt_v4\mingw64\x86_64-w64-mingw32\include\c++\ostream:384:7:
error: 'std::basic_ostream<_CharT, _Traits>::
basic_ostream() [with _CharT = std::basic_streambuf<char32_t,
std::char_traits<char32_t> >; _Traits =
std::char_traits<std::basic_streambuf<char32_t, std::char_
traits<char32_t> > >]' is protected
basic_ostream()
^
ostream2a.cpp:21:12: error: within this context
u32ostream u32cout;
^
and a whole bunch of other errors. I had thought you could simply use the
template <class charT, class traits = char_traits<charT> >
class basic_ostream;
based definition to create a new a type to instantiate a u16cout or ucout, but
apparently this is not so because of the protected-ness of the method.
there is probably a reason for this, I know of no workaround yet.
More information about the Gcc-bugs
mailing list