在 wxWidgets 中将字符串存储为 wstring 或 wxString?

Store strings as wstring or wxString in wxWidgets?

我必须在 class Language 中存储许多字符串。我将它们存储为 std::wstring。在 GUI 部分,我将在 wxListBox 中显示它们。据我所知,wxWidgets 处理 wxString。那么,我如何通过 wxString 而不是默认的 std::wstring 将字符串存储在 Language 中?他们说这样更好,然后代码的逻辑部分对GUI部分一无所知。

来自wxWidgets documentation

While the use of wxString is unavoidable in wxWidgets program, you are encouraged to use the standard string classes std::string or std::wstring in your applications and convert them to and from wxString only when interacting with wxWidgets.

wxString 有一个来自 std::wstring 的转换构造函数(除其他外),因此您可以在需要时轻松创建一个。