BloombergLP::bdlsb::MemOutStreamBuf_Util::computeNewCapacity

Return a suitable capacity for the specified length and capacity.

Synopsis

Declared in <bdlsb_memoutstreambuf.h>

static
std::size_t
computeNewCapacity(
    std::size_t newLength,
    std::size_t currentCapacity);

Description

Return the capacity to be used to contain data having the specified newLength when the current capacity is the specified currentCapacity. The returned value may be larger than newLength to allow for growth without the need for reallocation.

Return Value

capacity suitable for newLength given currentCapacity

Parameters

NameDescription
newLengthdesired data length in characters
currentCapacitycurrent buffer capacity in characters