Set.this - multiple declarations

Function Set.this

Constructor.

this (
  size_t n,
  shared Allocator allocator = defaultAllocator
);

this (
  shared Allocator allocator
);

Parameters

NameDescription
n Minimum number of buckets.
allocator Allocator.

Precondition

allocator !is null.

Example

auto set = Set!int(5);
assert(set.capacity == 7);

Function Set.this

Initializes this Set from another one.

this(S) (
  ref S init,
  shared Allocator allocator = defaultAllocator
)
if (is(Unqual!S == Set));

this(S) (
  S init,
  shared Allocator allocator = defaultAllocator
)
if (is(S == Set));

If init is passed by reference, it will be copied. If init is passed by value, it will be moved.

Parameters

NameDescription
S Source set type.
init Source set.
allocator Allocator.

Precondition

allocator !is null.

Function Set.this

Initializes the set from a forward range.

this(R) (
  scope R range,
  shared Allocator allocator = defaultAllocator
)
if (isForwardRange!R && isImplicitlyConvertible!(ElementType!R, T) && !isInfinite!R);

Parameters

NameDescription
R Range type.
range Forward range.
allocator Allocator.

Precondition

allocator !is null.

Example

int[2] range = [1, 2];
Set!int set = Set!int(range[]);

assert(1 in set);
assert(2 in set);

Function Set.this

Initializes the set from a static array.

this(size_t n) (
  T[n] array,
  shared Allocator allocator = defaultAllocator
);

Parameters

NameDescription
n Array size.
array Static array.
allocator Allocator.

Precondition

allocator !is null.

Example

Set!int set = Set!int([1, 2]);

assert(1 in set);
assert(2 in set);