Typedef liberate::types::varint_base

Typedef Documentation

using liberate::types::varint_base = int64_t

The varint type is an alias for its base type, but unlike a typedef or using declaration, it creates a separate type for which templates can be specialized.

It’s named varint, because other parts of liberate define specialized, variable length encodings for this type. In itself, it should behave very much like it’s base type, varint_base.

What is not defined are automatic conversions, which include conversions to and from bool. So this will fail:

varint foo = 32; if (foo) … if (!foo) …

Convenience functions to_varint() and from_varint() are provided:

varint foo = to_varint(32); if (from_varint(foo)) … if (!from_varint(foo)) …