Merge branch 'fix_closedhashtable_ctors' into 'master'

Fix ctor with LocalHeap in ClosedHashTable

See merge request jschoeberl/netgen!303
This commit is contained in:
Matthias Hochsteger 2019-12-03 12:46:49 +00:00
commit 2fc30ce10e

View File

@ -582,38 +582,28 @@ namespace ngcore
size_t size; size_t size;
size_t mask; size_t mask;
/// ///
size_t used; size_t used = 0;
/// ///
Array<T_HASH> hash; Array<T_HASH> hash;
/// ///
Array<T> cont; Array<T> cont;
/// ///
T_HASH invalid; T_HASH invalid = -1;
public: public:
/// ///
ClosedHashTable (size_t asize = 128) ClosedHashTable (size_t asize = 128)
: size(RoundUp2(asize)), used(0), hash(size), cont(size) : size(RoundUp2(asize)), hash(size), cont(size)
{ {
mask = size-1; mask = size-1;
invalid = -1;
hash = T_HASH(invalid); hash = T_HASH(invalid);
} }
ClosedHashTable (ClosedHashTable && ht2) = default; ClosedHashTable (ClosedHashTable && ht2) = default;
// who needs that ?
ClosedHashTable (FlatArray<T_HASH> _hash, FlatArray<T> _cont)
: size(_hash.Size()), used(0), hash(_hash.Size(), _hash.Addr(0)), cont(_cont.Size(), _cont.Addr(0))
{
invalid = -1;
hash = T_HASH(invalid);
}
/// allocate on local heap /// allocate on local heap
ClosedHashTable (size_t asize, LocalHeap & lh) ClosedHashTable (size_t asize, LocalHeap & lh)
: size(asize), hash(asize, lh), cont(asize, lh) : size(RoundUp2(asize)), mask(size-1), hash(size, lh), cont(size, lh)
{ {
invalid = -1;
hash = T_HASH(invalid); hash = T_HASH(invalid);
} }