Internals: Allow override of initial value for vl_unordered_set()

This commit is contained in:
Wilson Snyder 2018-07-05 20:39:03 -04:00
parent 81ef9b5dd2
commit 9156a0e400

View File

@ -195,7 +195,7 @@ public:
// CONSTRUCTORS
vl_unordered_set()
: m_numElements(0)
, m_log2Buckets(4)
, m_log2Buckets(initLog2Buckets())
, m_bucketsp(NULL)
, m_hash()
, 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) {
if (this != &other) {
@ -232,11 +235,9 @@ public:
return *this;
}
~vl_unordered_set() {
delete [] m_bucketsp; VL_DANGLING(m_bucketsp);
}
// METHODS
static size_t initLog2Buckets() { return 4; }
iterator begin() {
if (m_numElements) {
initBuckets();
@ -246,7 +247,6 @@ public:
}
return end();
}
const_iterator begin() const {
if (m_numElements) {
initBuckets();
@ -256,7 +256,6 @@ public:
}
return end();
}
const_iterator end() const {
return iterator(VL_ULL(0xFFFFFFFFFFFFFFFF),
const_cast<Bucket&>(m_emptyBucket).begin(), this);
@ -379,6 +378,7 @@ public:
m_bucketsp = NULL;
}
m_numElements = 0;
m_log2Buckets = initLog2Buckets();
}
private: