Usually when i want to check if more input stored in a multiple strings are not empty i follow this simple approach:
std::string fieldA = "";
std::string fieldB = "";
std::string fieldC = "Hello";
Now, i can check for all:
if ( fieldA.empty() || fieldB.empty() || fieldC.empty() )
std::cout << "Oh oh.. one or more fields are empty << std::endl;
But it would be nice to know which fields are empty, then, i can write:
if ( fieldA.empty() )
std::cout << "fieldA is empty" << std::endl;
if ( fieldB.empty() )
std::cout << "fieldB is empty" << std::endl;
if ( fieldC.empty() )
std::cout << "fieldC is empty" << std::endl;
But in this way i can discover that fieldA is empty but not the fieldB and in this example i have only three fields, but with more fields?
What is the best practice to managing the control of many strings and locate the empty string?