• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Trouble with std::basic_ostringstream and libc++
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Trouble with std::basic_ostringstream and libc++


  • Subject: Re: Trouble with std::basic_ostringstream and libc++
  • From: Marshall Clow <email@hidden>
  • Date: Mon, 09 Jul 2012 08:48:59 -0700

On Jul 9, 2012, at 8:33 AM, Jesper Papmehl-Dufay wrote:

> 9 jul 2012 kl. 16.58 skrev Howard Hinnant:
>
>> On Jul 9, 2012, at 10:15 AM, Jesper Papmehl-Dufay wrote:
>>
>>> I am having trouble getting code that uses std::basic_ostringstream to work when building with libc++. The same code works without any problems when building using libstdc++. (In both cases I’m building with Xcode 4.3.3, Apple LLVM compiler 3.1, and C++ Language Dialect set to C++11.)
>>>
>>> For example, the following program fails to compile:
>>>
>>> #include <sstream>
>>>
>>> int main(int argc, const char* argv[]) {
>>>  std::basic_ostringstream<int> myStream;
>>>  return 0;
>>> }
>>>
>>> with the error messages listed at the end of this mail.
>>>
>>> If I change std::basic_ostringstream<int> to std::ostringstream, it builds with our any problems (though I actually need a specific character type, so I cannot use ostringstream in my real program).
>>> And if I change the standard C++ library to libstdc++, it also builds without any problems.
>>>
>>> Does anyone have any idea what I might be doing wrong? Or is this simply a bug in libc++?
>>
>> The stream classes are only defined to work with char and wchar_t because Table 81 defines only ctype<char> and ctype<wchar_t>.
>>
>> Will std::basic_ostringstream<wchar_t> myStream work for you?
>
> Thanks for the reply!
> We have a cross-platform code base, and need a consistent and deterministic bit size and encoding (utf-16) for our strings. So wchar_t/wstring isn’t really an option for us (since it is, as far as I know, pretty undefined both when it comes to size and character encoding).
> Anyway, thanks for the clear reply, I guess we’ll have to find some other way (other than basic_ostringstream) to solve this.

That seems very … c++03-like to me.

I see that Table 81 shows specializations for char16_t and char32_t (albeit with an extra template parameter)
I wonder if those could be made to work. (since having a deterministic bit size is the whole reason for char16_t and char32_t)

-- Marshall

Marshall Clow     Idio Software   <mailto:email@hidden>

A.D. 1517: Martin Luther nails his 95 Theses to the church door and is promptly moderated down to (-1, Flamebait).
        -- Yu Suzuki


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden


References: 
 >Trouble with std::basic_ostringstream and libc++ (From: Jesper Papmehl-Dufay <email@hidden>)
 >Re: Trouble with std::basic_ostringstream and libc++ (From: Howard Hinnant <email@hidden>)
 >Re: Trouble with std::basic_ostringstream and libc++ (From: Jesper Papmehl-Dufay <email@hidden>)

  • Prev by Date: Re: Trouble with std::basic_ostringstream and libc++
  • Next by Date: Re: Trouble with std::basic_ostringstream and libc++
  • Previous by thread: Re: Trouble with std::basic_ostringstream and libc++
  • Next by thread: Re: Trouble with std::basic_ostringstream and libc++
  • Index(es):
    • Date
    • Thread