3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2026-07-01 12:58:54 +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:
Copilot 2026-01-22 17:39:53 -08:00 committed by GitHub
parent 6feb3391a2
commit 7f91a3321d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 22 additions and 24 deletions

View file

@ -382,9 +382,9 @@ namespace datalog {
rule_counter ctr;
ctr.count_rule_vars(r);
unsigned max_var_idx, new_var_idx_base;
if (ctr.get_max_positive(max_var_idx)) {
new_var_idx_base = max_var_idx+1;
unsigned new_var_idx_base;
if (auto max_var_idx = ctr.get_max_positive()) {
new_var_idx_base = *max_var_idx + 1;
}
else {
new_var_idx_base = 0;