I am looking for some tips on how to convert std::wstring to std::string , but a quick and dirty conversion to use as the key in the std::map<std::string, int> object.
The map is quite large and already well integrated into the project, and there are only a few keys that require this conversion, so I think it will be wasteful to change the map to one, which takes std::wstring as a key.
The result of the conversion does not matter much, but it must be consistent in order to reliably pull the correct values from the map every time.
The application is a Windows-only application.
Is there any known process for crude conversion for this purpose? Or is it best to use the usual, correct conversion process (as described in this SO question / answer: How to convert wstring to string? )?
Edit: Please keep in mind - information loss in order is not yet compatible. those. if I find some Japanese characters and they are successively converted to the same (potentially garbage) std::string , that's fine. It will never be displayed, only to be used as a key to pull values from the map.
Thanks!
source share