Last active
August 25, 2016 18:11
-
-
Save SeanCline/726b43a1c91928dfc34439f26369e6b2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#pragma once | |
#include <string> | |
// Why can't MFC and ATL just get along? | |
#if defined(_AFX) || defined(_AFXDLL) | |
# include <cstringt.h> | |
#else | |
# include <atlstr.h> | |
#endif | |
/* | |
* @breif Converts an CStringW (Wide CString) to a std::wstring. | |
*/ | |
inline std::wstring to_wstring(const CStringW& from) | |
{ | |
return std::wstring(static_cast<const wchar_t*>(from), from.GetLength()); | |
} | |
/* | |
* @breif Converts an CStringA (Ansi CString) to a std::wstring. | |
*/ | |
inline std::wstring to_wstring(const CStringA& from) | |
{ | |
return to_wstring(CStringW(from)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment