[#BloombergLP-bdlsb-MemOutStreamBuf_Util-computeNewCapacity]
= xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bdlsb.adoc[bdlsb]::xref:BloombergLP/bdlsb/MemOutStreamBuf_Util.adoc[MemOutStreamBuf&lowbar;Util]::computeNewCapacity
:relfileprefix: ../../../
:mrdocs:

Return a suitable capacity for the specified length and capacity&period;

== Synopsis

Declared in `&lt;bdlsb&lowbar;memoutstreambuf&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
static
std::size&lowbar;t
computeNewCapacity(
    std::size&lowbar;t newLength,
    std::size&lowbar;t currentCapacity);
----

== Description

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

== Return Value

capacity suitable for `newLength` given `currentCapacity`

== Parameters

[cols="1,4"]
|===
| Name| Description
| *newLength*
| desired data length in characters
| *currentCapacity*
| current buffer capacity in characters
|===


[.small]#Created with https://www.mrdocs.com[MrDocs]#
