Quantcast
Channel: Active questions tagged utf-8 - Stack Overflow
Viewing all articles
Browse latest Browse all 1053

typedef std::basic_string ustring; [closed]

$
0
0

I just upgraded from Xcode 16.2 to Xcode 16.3, compiling with C++11

I have been using this definition for years:

typedef std::basic_string<unsigned char> ustring;

but now, apparently, this functionality has been removed?

indeed, i see in the header for char_traits.h:

struct char_traits; /*The Standard does not define the base template for char_traits because it is impossible to provide etc etc

it had been working up until i upgraded my compiler, as a "temporary" definition had been provided.

the error message now is this:

implicit instantiation of undefined template 'std::char_traits<unsigned char>'

I tried just copying the temp definition from the headers of 16.2, but when i compile, i get this:

/Applications/Xcode-16.3.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX15.4.sdk/usr/include/c++/v1/string:821:42: error: implicit instantiation of undefined template 'std::char_traits<unsigned int>'821 | static_assert(is_same<_CharT, typename traits_type::char_type>::value,

I definitely have no devinition of std::char_traits<unsigned int>, never have had it. it compiled before, and now it doesn't with the same, unchanged code, even when i copy the missing part from the previous header.

Not sure what to do. I'm surprised it's so difficult just to declare a std::string with an unsigned char. (i use them everywhere in code to denote utf8 strings).

i know that C++20 has char8_t, but my app is MONUMENTAL and i just need a quick fix to get my ustring defined again in C++11.

anyone have a drop-in replacement for C++11?

minimal app is this:

compile with C++11 on Xcode 16.3

#include <string>typedef std::basic_string<unsigned char> ustring;void    main(){    ustring     str((const unsigned char *)"hello");    printf("%s\n", (const char *)str.c_str());}

Viewing all articles
Browse latest Browse all 1053

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>