mirror of
https://github.com/Z3Prover/z3
synced 2025-05-05 23:05:46 +00:00
Partial cleanup of util/lp/*
This commit is contained in:
parent
00651f8f21
commit
d61b722b68
109 changed files with 3503 additions and 2023 deletions
|
@ -1,14 +1,29 @@
|
|||
/*
|
||||
Copyright (c) 2017 Microsoft Corporation
|
||||
Author: Lev Nachmanson
|
||||
*/
|
||||
/*++
|
||||
Copyright (c) 2017 Microsoft Corporation
|
||||
|
||||
Module Name:
|
||||
|
||||
<name>
|
||||
|
||||
Abstract:
|
||||
|
||||
<abstract>
|
||||
|
||||
Author:
|
||||
|
||||
Lev Nachmanson (levnach)
|
||||
|
||||
Revision History:
|
||||
|
||||
|
||||
--*/
|
||||
|
||||
#pragma once
|
||||
// this class implements a map with some stack functionality
|
||||
#include <unordered_map>
|
||||
#include <set>
|
||||
#include <stack>
|
||||
namespace lean {
|
||||
namespace lp {
|
||||
|
||||
|
||||
template <typename A, typename B,
|
||||
|
@ -33,10 +48,10 @@ public:
|
|||
m_map.emplace_replace(m_key, b);
|
||||
return *this;
|
||||
}
|
||||
ref & operator=(const ref & b) { lean_assert(false); return *this; }
|
||||
ref & operator=(const ref & b) { SASSERT(false); return *this; }
|
||||
operator const B&() const {
|
||||
auto it = m_map.m_map.find(m_key);
|
||||
lean_assert(it != m_map.m_map.end());
|
||||
SASSERT(it != m_map.m_map.end());
|
||||
return it->second;
|
||||
}
|
||||
};
|
||||
|
@ -73,7 +88,7 @@ public:
|
|||
const B & operator[]( const A & a) const {
|
||||
auto it = m_map.find(a);
|
||||
if (it == m_map.end()) {
|
||||
lean_assert(false);
|
||||
SASSERT(false);
|
||||
}
|
||||
|
||||
return it->second;
|
||||
|
@ -128,7 +143,7 @@ public:
|
|||
for (auto & t: d.m_original_changed) {
|
||||
m_map[t.first] = t.second;
|
||||
}
|
||||
// lean_assert(d.m_deb_copy == m_map);
|
||||
// SASSERT(d.m_deb_copy == m_map);
|
||||
m_stack.pop();
|
||||
}
|
||||
}
|
||||
|
@ -142,7 +157,7 @@ public:
|
|||
delta & d = m_stack.top();
|
||||
auto it = m_map.find(key);
|
||||
if (it == m_map.end()) {
|
||||
lean_assert(d.m_new.find(key) == d.m_new.end());
|
||||
SASSERT(d.m_new.find(key) == d.m_new.end());
|
||||
return;
|
||||
}
|
||||
auto &orig_changed = d.m_original_changed;
|
||||
|
@ -151,7 +166,7 @@ public:
|
|||
if (orig_changed.find(key) == orig_changed.end())
|
||||
orig_changed.emplace(it->first, it->second); // need to restore
|
||||
} else { // k is new
|
||||
lean_assert(orig_changed.find(key) == orig_changed.end());
|
||||
SASSERT(orig_changed.find(key) == orig_changed.end());
|
||||
d.m_new.erase(nit);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue