absl::CordBuffer::IncreaseLengthBy

Increases the length of this buffer by the specified 'n' bytes.

Synopsis

Declared in <absl/strings/cord_buffer.h>

void
IncreaseLengthBy(size_t n);

Description

Applications must make sure all data in this buffer up to the new length has been initialized before adding a CordBuffer to a Cord: failure to do so will lead to undefined behavior. Requires length() + n <= capacity(). Typically, applications will use 'available_up_to()` to get a span of the desired capacity, and use span.size() to increase the length as in: absl::Span<char> span = buffer.available_up_to(desired); buffer.IncreaseLengthBy(span.size()); memcpy(span.data(), src, span.size()); etc...

Parameters

NameDescription
nThe number of bytes to add to the current length.