bitSlice

GC-Allocates a bitwise packed n-dimensional boolean slice.

@optmath
Slice!(FieldIterator!(BitField!(size_t*)), N)
bitSlice
(
size_t N
)
(
size_t[N] lengths...
)

Parameters

lengths size_t[N]

List of lengths for each dimension.

Return Value

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

n-dimensional bitwise slice

Examples

1D

auto bitarray = bitSlice(100); // allocates 16 bytes total
assert(bitarray.shape == [100]);
assert(bitarray[72] == false);
bitarray[72] = true;
assert(bitarray[72] == true);

2D

auto bitmatrix = bitSlice(20, 6); // allocates 16 bytes total
assert(bitmatrix.shape == [20, 6]);
assert(bitmatrix[3, 4] == false);
bitmatrix[3, 4] = true;
assert(bitmatrix[3, 4] == true);

See Also

Meta