Not Visual Studio anything.
In a C++11 program I intend to use Unicode and wstring and wchar_t. I am doing some bit parsing and bit manipulations for something and I want to have some results of that parsing in wstring or wchar_t. Thus, I want to put the 0's and 1's from some process into a wstring.
Example:
The Binary of [办] is [101001010011110].
I can input 办 and I can get 101001010011110.
I can parse into bits the 101001010011110 and do things with the result.
But,
I want to see the result in wstring.
Here is a test example:
If I used:
wstring x;and if I tried to then use:
x = std::to_wstring(101001010011110);I received an error similar to:
to_wstring is not a member of stdThe problem seems to be in my compiler.
I do not want to change my compiler.
I chose that compiler for specific reasons and I intend to use that particular compiler. Therefore I needed a work around for going from a number (1010101010) to a wide string. In this case, the number is ASCII.
So, I am going from ASCII to a string to a wide string.
The following is an actual part of my code that does work.
With notes.
Expand|Select|Wrap|Line Numbers
- int ix = 1010101010;
- std::string f_str = std::to_string(ix); // From int to wstring is not working with std::to_wstring on this compiler even though it is set to C++11
- // therefore going from int to string then from string to wstring.
- wstring wstr (f_str.begin(), f_str.end()); // Since it starts with an integer, which is in ASCII then
- // since this only works well if the string being converted contains only ASCII characters
- // Therefore, it is OK to use here.
A work around to get past "to_wstring is not a member of std" .