mirror of
https://github.com/Z3Prover/z3
synced 2026-02-25 09:41:19 +00:00
Refactor counter::get_max_positive to use std::optional (#8289)
* Initial plan * Refactor counter::get_max_positive to use std::optional Co-authored-by: NikolajBjorner <3085284+NikolajBjorner@users.noreply.github.com> * Fix C++17 compatibility by replacing transform() with has_value()/value() Co-authored-by: NikolajBjorner <3085284+NikolajBjorner@users.noreply.github.com> * Address code review: avoid calling get_max_positive twice Co-authored-by: NikolajBjorner <3085284+NikolajBjorner@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: NikolajBjorner <3085284+NikolajBjorner@users.noreply.github.com>
This commit is contained in:
parent
6feb3391a2
commit
7f91a3321d
6 changed files with 22 additions and 24 deletions
|
|
@ -585,7 +585,7 @@ namespace datalog {
|
|||
}
|
||||
counter ctr;
|
||||
ctr.count(joined_col_cnt, tgt_cols);
|
||||
if (ctr.get_max_counter_value()>1 || (joined_col_cnt && ctr.get_max_positive()!=joined_col_cnt-1)) {
|
||||
if (ctr.get_max_counter_value()>1 || (joined_col_cnt && ctr.get_max_positive().value_or(0)!=joined_col_cnt-1)) {
|
||||
return nullptr;
|
||||
}
|
||||
return alloc(intersection_filter_fn, *this);
|
||||
|
|
@ -712,8 +712,8 @@ namespace datalog {
|
|||
rule * mk_explanations::get_e_rule(rule * r) {
|
||||
rule_counter ctr;
|
||||
ctr.count_rule_vars(r);
|
||||
unsigned max_var;
|
||||
unsigned next_var = ctr.get_max_positive(max_var) ? (max_var+1) : 0;
|
||||
auto max_var = ctr.get_max_positive();
|
||||
unsigned next_var = max_var.has_value() ? (*max_var + 1) : 0;
|
||||
unsigned head_var = next_var++;
|
||||
app_ref e_head(get_e_lit(r->get_head(), head_var), m_manager);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue