summaryrefslogtreecommitdiff
path: root/src/prop/bvminisat/mtl/Map.h
diff options
context:
space:
mode:
authorMathias Preiner <mathias.preiner@gmail.com>2021-03-10 15:58:11 -0800
committerGitHub <noreply@github.com>2021-03-10 23:58:11 +0000
commit982d1bea6ec9ac9b8932f99762ab2b3908958f32 (patch)
tree4f5ba9a5559d9b273a514f60eb9b354555e74b95 /src/prop/bvminisat/mtl/Map.h
parent489209a31c2a2bf2f5ce465c1a79f73aad90c764 (diff)
Use Assert instead of assert. (#6095)
This commit replaces all uses of assert with Assert from base/check.h to ensure that all assertions get checked in production builds with enabled assertions.
Diffstat (limited to 'src/prop/bvminisat/mtl/Map.h')
-rw-r--r--src/prop/bvminisat/mtl/Map.h52
1 files changed, 26 insertions, 26 deletions
diff --git a/src/prop/bvminisat/mtl/Map.h b/src/prop/bvminisat/mtl/Map.h
index ee68a2155..919149fa9 100644
--- a/src/prop/bvminisat/mtl/Map.h
+++ b/src/prop/bvminisat/mtl/Map.h
@@ -20,6 +20,7 @@ OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWA
#ifndef BVMinisat_Map_h
#define BVMinisat_Map_h
+#include "base/check.h"
#include "prop/bvminisat/mtl/IntTypes.h"
#include "prop/bvminisat/mtl/Vec.h"
@@ -68,8 +69,8 @@ class Map {
int size;
// Don't allow copying (error prone):
- Map<K,D,H,E>& operator = (Map<K,D,H,E>& other) { assert(0); }
- Map (Map<K,D,H,E>& other) { assert(0); }
+ Map<K, D, H, E>& operator=(Map<K, D, H, E>& other) { Assert(0); }
+ Map(Map<K, D, H, E>& other) { Assert(0); }
bool checkCap(int new_size) const { return new_size > cap; }
@@ -108,27 +109,25 @@ class Map {
// PRECONDITION: the key must already exist in the map.
const D& operator [] (const K& k) const
{
- assert(size != 0);
- const D* res = NULL;
- const vec<Pair>& ps = table[index(k)];
- for (int i = 0; i < ps.size(); i++)
- if (equals(ps[i].key, k))
- res = &ps[i].data;
- assert(res != NULL);
- return *res;
+ Assert(size != 0);
+ const D* res = NULL;
+ const vec<Pair>& ps = table[index(k)];
+ for (int i = 0; i < ps.size(); i++)
+ if (equals(ps[i].key, k)) res = &ps[i].data;
+ Assert(res != NULL);
+ return *res;
}
// PRECONDITION: the key must already exist in the map.
D& operator [] (const K& k)
{
- assert(size != 0);
- D* res = NULL;
- vec<Pair>& ps = table[index(k)];
- for (int i = 0; i < ps.size(); i++)
- if (equals(ps[i].key, k))
- res = &ps[i].data;
- assert(res != NULL);
- return *res;
+ Assert(size != 0);
+ D* res = NULL;
+ vec<Pair>& ps = table[index(k)];
+ for (int i = 0; i < ps.size(); i++)
+ if (equals(ps[i].key, k)) res = &ps[i].data;
+ Assert(res != NULL);
+ return *res;
}
// PRECONDITION: the key must *NOT* exist in the map.
@@ -154,14 +153,15 @@ class Map {
// PRECONDITION: the key must exist in the map.
void remove(const K& k) {
- assert(table != NULL);
- vec<Pair>& ps = table[index(k)];
- int j = 0;
- for (; j < ps.size() && !equals(ps[j].key, k); j++);
- assert(j < ps.size());
- ps[j] = ps.last();
- ps.pop();
- size--;
+ Assert(table != NULL);
+ vec<Pair>& ps = table[index(k)];
+ int j = 0;
+ for (; j < ps.size() && !equals(ps[j].key, k); j++)
+ ;
+ Assert(j < ps.size());
+ ps[j] = ps.last();
+ ps.pop();
+ size--;
}
void clear () {
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback