3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-04-26 02:25:32 +00:00

Z3 sources

Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
This commit is contained in:
Leonardo de Moura 2012-10-02 11:35:25 -07:00
parent 3f9edad676
commit e9eab22e5c
1186 changed files with 381859 additions and 0 deletions

60
lib/uint_map.h Normal file
View file

@ -0,0 +1,60 @@
/*++
Copyright (c) 2006 Microsoft Corporation
Module Name:
uint_map.h
Abstract:
<abstract>
Author:
Leonardo de Moura (leonardo) 2010-07-01.
Revision History:
--*/
#ifndef _UINT_MAP_H_
#define _UINT_MAP_H_
#include"vector.h"
/**
\brief Implement a map from unsigned to T * using vectors
*/
template<typename T>
class uint_map {
ptr_vector<T> m_map;
public:
bool contains(unsigned k) const { return m_map.get(k, 0) != 0; }
bool find(unsigned k, T * & v) const {
if (k >= m_map.size())
return false;
else {
v = m_map[k];
return v != 0;
}
}
void insert(unsigned k, T * v) {
m_map.reserve(k+1);
m_map[k] = v;
SASSERT(contains(k));
}
void erase(unsigned k) {
if (k < m_map.size())
m_map[k] = 0;
}
void reset() {
m_map.reset();
}
};
#endif /* _UINT_MAP_H_ */