mirror of
https://github.com/Z3Prover/z3
synced 2026-01-22 01:54:44 +00:00
Replace custom util/optional with std::optional (#8162)
* Initial plan * Replace optional with std::optional in source files Co-authored-by: NikolajBjorner <3085284+NikolajBjorner@users.noreply.github.com> * Fix array_map contains() and remove optional_benchmark test Co-authored-by: NikolajBjorner <3085284+NikolajBjorner@users.noreply.github.com> * Address code review feedback - simplify array_map and test 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
40250bfcb8
commit
4d188f07e9
15 changed files with 34 additions and 592 deletions
|
|
@ -19,12 +19,11 @@ Revision History:
|
|||
#include "util/trace.h"
|
||||
#include "util/debug.h"
|
||||
#include "util/memory_manager.h"
|
||||
#include "util/optional.h"
|
||||
#include <optional>
|
||||
|
||||
static void tst1() {
|
||||
optional<int> v;
|
||||
ENSURE(!v);
|
||||
ENSURE(v == false);
|
||||
std::optional<int> v;
|
||||
ENSURE(!v.has_value());
|
||||
v = 10;
|
||||
ENSURE(v);
|
||||
ENSURE(*v == 10);
|
||||
|
|
@ -45,7 +44,7 @@ struct OptFoo {
|
|||
};
|
||||
|
||||
static void tst2() {
|
||||
optional<OptFoo> v;
|
||||
std::optional<OptFoo> v;
|
||||
ENSURE(!v);
|
||||
v = OptFoo(10, 20);
|
||||
ENSURE(v->m_x == 10);
|
||||
|
|
@ -57,7 +56,7 @@ static void tst2() {
|
|||
}
|
||||
|
||||
static void tst3() {
|
||||
optional<int *> v;
|
||||
std::optional<int *> v;
|
||||
ENSURE(!v);
|
||||
int x = 10;
|
||||
v = &x;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue