3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2026-02-10 19:05:25 +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

@ -486,7 +486,7 @@ namespace datalog {
DEBUG_CODE(
counter ctr;
ctr.count(permutation);
SASSERT(permutation.empty() || ctr.get_max_positive()==permutation.size()-1);
SASSERT(permutation.empty() || ctr.get_max_positive().value_or(0)==permutation.size()-1);
SASSERT(permutation.empty() || ctr.get_positive_count()==permutation.size());
);
unsigned sz = permutation.size();