bitRcslice

Allocates a bitwise packed n-dimensional reference-counted (thread-safe) boolean slice.

@optmath
bitRcslice
(
size_t N
)
(
size_t[N] lengths...
)

Parameters

lengths size_t[N]

List of lengths for each dimension.

Return Value

Type: Slice!(FieldIterator!(BitField!(RCI!size_t)), N)

n-dimensional bitwise rcslice

Examples

1D

auto bitarray = 100.bitRcslice; // allocates 16 bytes total (plus RC context)
assert(bitarray.shape == cast(size_t[1])[100]);
assert(bitarray[72] == false);
bitarray[72] = true;
assert(bitarray[72] == true);

2D

auto bitmatrix = bitRcslice(20, 6); // allocates 16 bytes total (plus RC context)
assert(bitmatrix.shape == cast(size_t[2])[20, 6]);
assert(bitmatrix[3, 4] == false);
bitmatrix[3, 4] = true;
assert(bitmatrix[3, 4] == true);

See Also

Meta