J
Jason Heyes
I have a std::string 's' and I write:
s.erase();
Does this make the string empty?
Thanks.
s.erase();
Does this make the string empty?
Thanks.
Jason said:I have a std::string 's' and I write:
s.erase();
Does this make the string empty?
Depends on how you define 'empty'.
Jason said:s.empty()
Try this to check yourself:
<code>
#include <string>
#include <iostream>
int main()
{
std::string s("Hello World");
s.erase();
std::cout << "s is " << (s.empty() ? "empty" : "not empty") <<
std::endl;
return 0;
}
</code>
Jason said:I would prefer a direct answer.
Can't be that hard to figure out...
$ ./strempty
s is empty
Jason said:I'm trying to conserve brain cells.
Rolf said:Jason Heyes wrote:
You have a big problem either with your brain or with your computer if
compiling and executing a small test program destroys a significant amount
of your brain cells.
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.