Reputation: 5352
Is there an equivalent to std::stringstream
which will allow me to build a std::u32string
? If not how could I build up a std::u32string
from lots of variable length pieces of text consisting of char32_t
data?
Upvotes: 8
Views: 1634
Reputation: 1809
Although the other answers are correct, that in theory this is fine. In practice it is not always so for all functionality.
Using (some versions of?) Visual Studio, the locales do not seem to work properly for char16_t and char32_t character types. These are used to get the decimal and thousand separator. Hence if you try to add a number to the stream you will receive a compilation error. I know this is at least the case for the version I am using VS 2019 4.8.03752.
Upvotes: 2