ConvertBits

Convert from one power-of-2 number base to another.

Synopsis

Declared in <util/strencodings.h>

template<
    int frombits,
    int tobits,
    bool pad,
    typename O,
    typename It,
    typename I = std::identity>
bool
ConvertBits(
    O outfn,
    It it,
    It end,
    I infn = {});

Return Value

true on success, false if an input value is invalid or leftover bits cannot be padded.

Parameters

NameDescription
outfnCallback invoked with each produced output value.
itIterator to the first input value.
endIterator past the last input value.
infnCallback mapping each input element to a non-negative integer value.