MixedRadixCoder

A mixed-radix number coding system.

Members

Aliases

VariableLengthEncoder
alias VariableLengthEncoder = Encoder!(-1)

As above. This will allocate the items dynamically.

Structs

Decoder
struct Decoder

The decoder.

Encoder
struct Encoder(size_t maxItems)

This encoding system is LIFO, so the encoder buffers all items until .finish is called.

RetroEncoder
struct RetroEncoder

Like Encoder, but does not use a temporary buffer. Instead, the user is expected to put the items in reverse order.

Examples

alias Coder = MixedRadixCoder!(uint, uint, true);
Coder.Encoder!2 encoder;
encoder.put(5, 8);
encoder.put(1, 2);
auto result = encoder.finish();

auto decoder = Coder.Decoder(result);
assert(decoder.get(8) == 5);
assert(decoder.get(2) == 1);
assert(decoder.empty);

Meta