This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug libstdc++/60711] basic_ostringstream,basic_ostream,u16string,char16_t do not work together


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60711

Jim Michaels <jmichae3 at yahoo dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|INVALID                     |FIXED

--- Comment #7 from Jim Michaels <jmichae3 at yahoo dot com> ---
found what I thought was a workaround, the streambuf thing is a constructor in
the basic_ostream class.
#include <ostream>
#include <streambuf>
#include <sstream>
#include <vector>
#include <string>
#include <ios>
#include <initializer_list>
#include <uchar.h>
#include <wchar.h>
typedef std::vector<std::u16string> Vu16S;
typedef std::basic_ostringstream<char16_t, std::char_traits<char16_t>,
std::allocator<char16_t> > u16ostringstream;
typedef std::basic_ostringstream<char32_t, std::char_traits<char32_t>,
std::allocator<char32_t> > u32ostringstream;
//typedef std::basic_ostream<char16_t, std::char_traits<char16_t> > u16ostream;
//typedef std::basic_ostream<char32_t, std::char_traits<char32_t> > u32ostream;
std::basic_ostringstream<std::basic_stringbuf<char16_t> > u16ograph;
std::basic_ostringstream<std::basic_stringbuf<char32_t> > u32ograph;
typedef std::basic_streambuf<char16_t, std::char_traits<char16_t> >
u16streambuf;
typedef std::basic_streambuf<char32_t, std::char_traits<char32_t> >
u32streambuf;
u16streambuf u16sb;
u32streambuf u32sb;
std::basic_ostream<char16_t, std::char_traits<char16_t> > u16cout(u16sb);
std::basic_ostream<char32_t, std::char_traits<char32_t> > u32cout(u32sb);
//uostream ucout;
//u32ostream u32cout;

Vu16S vu16blockss={u"\u00a0",u"\u2591",u"\u2592",u"\u2593",u"\u2588"};
int main(void) {
    uostringstream o16graph;
    ograph<<vu16blockss[1];
    ucout<<ograph.str();
    ucout<<u"\u00a0\u2591\u2592\u2593\u2588";
    return 0;
}

but this time streambuf is protected. :-(

f:\x86_64-4.9.0-snapshot-20140219-rev207854-win32-sjlj-rt_v4\mingw64\x86_64-w64-mingw32\include\c++\streambuf:463:7:
error: 'std::basic_streambuf<_CharT, _Trait
s>::basic_streambuf() [with _CharT = char16_t; _Traits =
std::char_traits<char16_t>]' is protected
       basic_streambuf()
       ^
ostream2a.cpp:20:14: error: within this context


hmm. I could not find a definition/constructor for basic_streambuf.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]