Re: Trouble with std::basic_ostringstream and libc++
Re: Trouble with std::basic_ostringstream and libc++
- Subject: Re: Trouble with std::basic_ostringstream and libc++
- From: Jesper Papmehl-Dufay <email@hidden>
- Date: Mon, 09 Jul 2012 17:33:57 +0200
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.
/Jesper
_______________________________________________
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