View source code
Display the source code in std/bitmanip.d from which this page was generated on github.
Report a bug
If you spot a problem with this page, click here to create a Bugzilla issue.
Improve this page
Quickly fork, edit online, and submit a pull request for this page. Requires a signed-in GitHub account. This works well for small changes. If you'd like to make larger changes you may want to consider using local clone.

std.bitmanip.BitArray.opCast - multiple declarations

Function BitArray.opCast

Convert to void[].

inout inout(void)[] opCast(T)() pure nothrow @nogc;

Function BitArray.opCast

Convert to size_t[].

inout inout(size_t)[] opCast(T)() pure nothrow @nogc;

Example

import std.array : array;
import std.range : repeat, take;

// bit array with 300 elements
auto a = BitArray(true.repeat.take(300).array);
size_t[] v = cast(size_t[]) a;
const blockSize = size_t.sizeof * 8;
writeln(v.length); // (a.length + blockSize - 1) / blockSize

Authors

Walter Bright, Andrei Alexandrescu, Jonathan M Davis, Alex Rønne Petersen, Damian Ziemba, Amaury SECHET

License

Boost License 1.0.