What's the correct usage of std::basic_string? I am trying to re-declare the string type with an unsigned char type.
#include <iostream>
using namespace std;
int main()
{
typedef basic_string<unsigned char> ustring;
unsigned char unsgndstring[] = {0xFF,0xF1};
ustring lol = unsgndstring;
cout << lol << endl;
return 0;
}
When I try the above code, I get:
main.cpp:25:10: error: no match for 'operator<<' (operand types are 'std::ostream {aka std::basic_ostream}' and 'ustring {aka std::basic_string}')
cout << lol << endl;
^
Why am I getting that? What's the correct way to declare a new string type that can hold unsigned chars?
basic_string<unsigned char>works, that doesn't mean all code out there written to usebasic_string<char>will be compatible with it. Is there a particular reason you think there's supposed to be anoperator<<that support this?#include <string>?std::string;)