checkedByteCount

fnbool checkedByteCount(size_t count, size_t elementSize, out size_t bytes) @safe pure nothrow @nogc

An overflow-checked count * elementSize.

The one typed helper this module ships; typed allocation belongs with the typed owners that use it.

Parameters

countnumber of elements.
elementSizesize of one element in bytes; 0 yields 0 bytes.
bytesreceives count * elementSize, or 0 on overflow.

Returns

false when the product overflows size_t, true otherwise.