You can't; at least not the same way you can test whether a pointer is NULL
.
A std::string
object is always initialized and always contains a string; its contents by default are an empty string (""
).
You can test for emptiness (using s.size() == 0
or s.empty()
).