Internals: Allow override of initial value for vl_unordered_set()
This commit is contained in:
parent
81ef9b5dd2
commit
9156a0e400
|
|
@ -195,7 +195,7 @@ public:
|
||||||
// CONSTRUCTORS
|
// CONSTRUCTORS
|
||||||
vl_unordered_set()
|
vl_unordered_set()
|
||||||
: m_numElements(0)
|
: m_numElements(0)
|
||||||
, m_log2Buckets(4)
|
, m_log2Buckets(initLog2Buckets())
|
||||||
, m_bucketsp(NULL)
|
, m_bucketsp(NULL)
|
||||||
, m_hash()
|
, m_hash()
|
||||||
, m_equal() { }
|
, m_equal() { }
|
||||||
|
|
@ -213,6 +213,9 @@ public:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
~vl_unordered_set() {
|
||||||
|
delete [] m_bucketsp; VL_DANGLING(m_bucketsp);
|
||||||
|
}
|
||||||
|
|
||||||
vl_unordered_set& operator=(const vl_unordered_set& other) {
|
vl_unordered_set& operator=(const vl_unordered_set& other) {
|
||||||
if (this != &other) {
|
if (this != &other) {
|
||||||
|
|
@ -232,11 +235,9 @@ public:
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
~vl_unordered_set() {
|
|
||||||
delete [] m_bucketsp; VL_DANGLING(m_bucketsp);
|
|
||||||
}
|
|
||||||
|
|
||||||
// METHODS
|
// METHODS
|
||||||
|
static size_t initLog2Buckets() { return 4; }
|
||||||
|
|
||||||
iterator begin() {
|
iterator begin() {
|
||||||
if (m_numElements) {
|
if (m_numElements) {
|
||||||
initBuckets();
|
initBuckets();
|
||||||
|
|
@ -246,7 +247,6 @@ public:
|
||||||
}
|
}
|
||||||
return end();
|
return end();
|
||||||
}
|
}
|
||||||
|
|
||||||
const_iterator begin() const {
|
const_iterator begin() const {
|
||||||
if (m_numElements) {
|
if (m_numElements) {
|
||||||
initBuckets();
|
initBuckets();
|
||||||
|
|
@ -256,7 +256,6 @@ public:
|
||||||
}
|
}
|
||||||
return end();
|
return end();
|
||||||
}
|
}
|
||||||
|
|
||||||
const_iterator end() const {
|
const_iterator end() const {
|
||||||
return iterator(VL_ULL(0xFFFFFFFFFFFFFFFF),
|
return iterator(VL_ULL(0xFFFFFFFFFFFFFFFF),
|
||||||
const_cast<Bucket&>(m_emptyBucket).begin(), this);
|
const_cast<Bucket&>(m_emptyBucket).begin(), this);
|
||||||
|
|
@ -379,6 +378,7 @@ public:
|
||||||
m_bucketsp = NULL;
|
m_bucketsp = NULL;
|
||||||
}
|
}
|
||||||
m_numElements = 0;
|
m_numElements = 0;
|
||||||
|
m_log2Buckets = initLog2Buckets();
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue