Would it matter if my C++ code (as shown below) has a string initialized as an empty string:
std::string myStr = "";
....some code to optionally populate 'myStr'...
if (myStr != "") {
// do something
}
vs. no/null initialization:
std::string myStr;
....some code to optionally populate 'myStr'...
if (myStr != NULL) {
// do something
}
Are there any concerns here?
There’s a function
empty()ready for you instd::string:or