[英]What is the macro for std::string/std::wstring in vc++?
根據 MSDN:
https://msdn.microsoft.com/en-us/library/windows/desktop/ff381407%28v=vs.85%29.aspx
您可以為 char 或 wchar_t 編寫 TCHAR 取決於編譯器 MACRO UNICODE
std::string 和 std::wstring 是否有類似的符號?
謝謝!
(我的 VC++ 版本是 2013)
你可以自己定義:
typedef basic_string<TCHAR, char_traits<TCHAR>, allocator<TCHAR> > tstring;
我沒有找到。 我自己在我的代碼中寫了一個這樣的 -
#ifdef UNICODE
#define tstring std::wstring
#else
#define tstring std::string
#endif
您還可以通過在 stdafx.h 中添加命名空間來稍微調整一下
namespace std {
typedef basic_string<TCHAR, char_traits<TCHAR>, allocator<TCHAR> > tstring;
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.