How to clear a string?I have a data member const std::string& n.I need to clear n value when i give an invalid input.I tried the below code:
n.clear();//not working
n.erase();//no instance of overloaded function.
memset(n,0,sizeof n);//no conversion from const std::string to void* exists.
Let me know what is the correct way to clear a string.