StaticBitArray.toString

Return a string representation of this StaticBitArray.

Two format specifiers are supported:

  • %s which prints the bits as an array, and
  • %b which prints the bits as 8-bit byte packets
  • separated with an underscore.

    struct StaticBitArray(uint capacity, Block = DefaultBlock)
    @safe const @trusted
    void
    toString
    (
    Sink
    )
    (
    ref scope Sink sink
    ,
    FormatSpec!char fmt
    )
    if (
    isUnsigned!DefaultBlock
    )

    Examples

    const b = StaticBitArray!16(([0, 0, 0, 0, 1, 1, 1, 1,
    							  0, 0, 0, 0, 1, 1, 1, 1]));
    const s1 = format("%s", b);
    version (none) assert(s1 == "[0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1]"); /+ TODO: enable +/
    
    version (none) const s2 = format("%b", b); /+ TODO: enable +/
    version (none) assert(s2 == "00001111_00001111"); /+ TODO: enable +/
    

    Meta