BucketSet.this

Constructor.

Sets the number of buckets to n / load_factor, rounded up to the nearest power or 2.

  1. this(size_t n, float load_factor)
  2. this(IAllocator allocator, size_t n, float load_factor)
    class BucketSet(size_t V, K = hash_t)
    protected
    this
    (,
    size_t n
    ,
    float load_factor = 0.75
    )

Parameters

allocator IAllocator

allocator to use to allocate with

n size_t

expected number of elements in bucket set

load_factor float

ratio of n to the number of buckets. The desired (approximate) number of elements per bucket. For example, 0.5 sets the number of buckets to double n; for 2 the number of buckets is the half of n. load_factor must be greater than 0 (this is asserted in IBucketSet.calcNumBucketsExp2()). The load factor is basically a trade-off between memory usage (number of buckets) and search time (number of elements per bucket).

Examples

Ensures that Bucket.init consists only of zero bytes so that the memset() method in clear() will work.

test(isClearable!(Bucket),
       Bucket.stringof ~ ".init contains non-zero byte: " ~
       typeof (this).stringof ~ ".clear_() will not work");

Meta