3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-08-25 12:35:59 +00:00

Prefer using empty rather than size comparisons.

This commit is contained in:
Bruce Mitchener 2018-11-27 21:42:04 +07:00
parent a83097d5cc
commit e570940662
56 changed files with 104 additions and 104 deletions

View file

@ -117,7 +117,7 @@ public:
unknown_options.push_back(t);
}
}
if (unknown_options.size()) {
if (!unknown_options.empty()) {
ret = "Unknown options:";
}
for (const auto & unknownOption : unknown_options) {
@ -127,15 +127,15 @@ public:
ret += "\n";
ret += "Usage:\n";
for (auto allowed_option : m_options)
ret += allowed_option.first + " " + (allowed_option.second.size() == 0 ? std::string("") : std::string("/") + allowed_option.second) + std::string("\n");
ret += allowed_option.first + " " + (allowed_option.second.empty() ? std::string("") : std::string("/") + allowed_option.second) + std::string("\n");
for (auto s : m_options_with_after_string) {
ret += s.first + " " + (s.second.size() == 0? " \"option value\"":("\""+ s.second+"\"")) + "\n";
ret += s.first + " " + (s.second.empty()? " \"option value\"":("\""+ s.second+"\"")) + "\n";
}
return ret;
}
void print() {
if (m_used_options.size() == 0 && m_used_options_with_after_string.size() == 0 && m_free_args.size() == 0) {
if (m_used_options.empty() && m_used_options_with_after_string.empty() && m_free_args.empty()) {
std::cout << "no options are given" << std::endl;
return;
}
@ -146,7 +146,7 @@ public:
for (auto & t : m_used_options_with_after_string) {
std::cout << t.first << " " << t.second << std::endl;
}
if (m_free_args.size() > 0) {
if (!m_free_args.empty()) {
std::cout << "free arguments are: " << std::endl;
for (auto & t : m_free_args) {
std::cout << t << " " << std::endl;