My project has legacy library which consider NULL pointer as empty string.
But when I get return data from std::wstring like this,
std::wstring strData;
const wchar* pStr = strData.c_str();
ASSERT(NULL == pStr); // ASSERT!!
pStr is not NULL but pointer which wstring point.
Can I make std::string return NULL when it has no string data? Now I wrap every str member variable like this :
const wchar* GetName() { // I hate this kinds of wrapping function
if (m_Name.empty())
{
return NULL;
}
return m_Name.c_str();
}
My working environment is Visual Studio 2008 sp1 in Windows
Thanks in advance.