This project is read-only.

std::string vs. std::wstring

Jun 15, 2013 at 1:43 AM
I wanted to take a quick pole of the Hieroglyph 3 faithful regarding std::string vs. std::wstring. Currently the engine compiles with Unicode support, and most of the engine utilizes std::wstring. I made this decision long ago, and now that I am working more and more with C++ I am finding that I don't care for std::wstring anymore.

Lua doesn't like std::wstring or wchar_t, which limits its usefulness. In addition, the shader files are also based on char instead of wchar_t. So there are areas already that mandate std::string, but not all of them of course.

So what is your experience with this? Do you need Unicode support, or is it something we can remove and just use regular std::string? I certainly don't want to cause unnecessary problems for the users of Hieroglyph, so please let me know your opinion.
Jun 15, 2013 at 6:04 PM
Edited Jun 15, 2013 at 6:04 PM
Is this a question about the use of Multi-Byte Character Set Config?

I use the wstring for literals like pathes. But i hate it too. You have always to convert through all formats.

I have not enough experience on benefits or drawbacks. If you think thats a way to handle things better and it improve the engine, i would say YES!
Jun 18, 2013 at 3:38 AM
Thanks for the input. This is actually for Unicode rather than MBCS, but the idea is the same. If it isn't needed, then I would probably just stick with plain old char based strings and std::string. I originally thought it would be nice to support std::wstring since it could make it easier to enable internationalization, but I have yet to see where that could be helpful since I implemented the wstring throughout the engine.

This would be a low priority task, but unless someone says otherwise then I think I will move towards converting to all std::string implementation.