std::wstring::clear
should work, as both it and std::string
are std::basic_string
s. Check out std::basic_string documentation if you're somehow having trouble.
#include <iostream>
int main()
{
std::string regularString("regular string!");
std::wstring wideString(L"wide string!");
std::cout << regularString << std::endl << "size: " << regularString.size() << std::endl;
std::wcout << wideString << std::endl << "size: " << wideString.size() << std::endl;
regularString.clear();
wideString.clear();
std::cout << regularString << std::endl << "size: " << regularString.size() << std::endl;
std::wcout << wideString << std::endl << "size: " << wideString.size() << std::endl;
}
Output:
regular string!
size: 15
wide string!
size: 12
size: 0
size: 0
Here's an ideone link to that code.