mirror of
https://github.com/Z3Prover/z3
synced 2026-02-14 12:51:48 +00:00
Apply code simplification improvements
- Consolidated two contains() methods into single template function - Added const correctness to helper methods in argument_parser.h - Improved string handling (replaced substr with compare, return "" instead of std::string()) - Fixed indentation in nlsat_solver.cpp nested loop - Modernized empty container return syntax in lp.cpp Co-authored-by: NikolajBjorner <3085284+NikolajBjorner@users.noreply.github.com>
This commit is contained in:
parent
160b98786f
commit
bb177988eb
3 changed files with 13 additions and 16 deletions
|
|
@ -1208,8 +1208,8 @@ namespace nlsat {
|
|||
used_bools[b] = true;
|
||||
vars.reset();
|
||||
this->vars(lit, vars);
|
||||
for (var v : vars)
|
||||
used_vars[v] = true;
|
||||
for (var v : vars)
|
||||
used_vars[v] = true;
|
||||
}
|
||||
display(out << "(echo \"#" << m_lemma_count++ << ":" << annotation << ":", n, cls) << "\")\n";
|
||||
if (m_log_lemma_smtrat)
|
||||
|
|
|
|||
|
|
@ -82,11 +82,8 @@ public:
|
|||
return status_is_ok;
|
||||
}
|
||||
|
||||
bool contains(std::unordered_map<std::string, std::string> & m, const std::string& s) {
|
||||
return m.find(s) != m.end();
|
||||
}
|
||||
|
||||
bool contains(std::set<std::string> & m, const std::string& s) {
|
||||
template<typename Container>
|
||||
bool contains(const Container& m, const std::string& s) const {
|
||||
return m.find(s) != m.end();
|
||||
}
|
||||
|
||||
|
|
@ -94,22 +91,22 @@ public:
|
|||
return contains(m_used_options, option) || contains(m_used_options_with_after_string, option);
|
||||
}
|
||||
|
||||
std::string get_option_value(const std::string& option) {
|
||||
std::string get_option_value(const std::string& option) const {
|
||||
auto t = m_used_options_with_after_string.find(option);
|
||||
if (t != m_used_options_with_after_string.end()){
|
||||
if (t != m_used_options_with_after_string.end()) {
|
||||
return t->second;
|
||||
}
|
||||
return std::string();
|
||||
return "";
|
||||
}
|
||||
|
||||
bool starts_with(const std::string& s, char const * prefix) {
|
||||
bool starts_with(const std::string& s, const std::string& prefix) const {
|
||||
return s.size() >= prefix.size() && s.compare(0, prefix.size(), prefix) == 0;
|
||||
}
|
||||
|
||||
bool starts_with(const std::string& s, const char* prefix) const {
|
||||
return starts_with(s, std::string(prefix));
|
||||
}
|
||||
|
||||
bool starts_with(const std::string& s, const std::string& prefix) {
|
||||
return s.substr(0, prefix.size()) == prefix;
|
||||
}
|
||||
|
||||
std::string usage_string() {
|
||||
std::string ret = "";
|
||||
std::vector<std::string> unknown_options;
|
||||
|
|
|
|||
|
|
@ -732,7 +732,7 @@ vector<std::string> get_file_names_from_file_list(const std::string& filelist) {
|
|||
std::ifstream file(filelist);
|
||||
if (!file.is_open()) {
|
||||
std::cout << "cannot open " << filelist << std::endl;
|
||||
return vector<std::string>();
|
||||
return {};
|
||||
}
|
||||
vector<std::string> ret;
|
||||
bool end;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue