[#BloombergLP-bdlcc-SharedObjectPool]
= xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bdlcc.adoc[bdlcc]::SharedObjectPool
:relfileprefix: ../../
:mrdocs:

This class provides a thread&hyphen;safe pool of `bsl&colon;&colon;shared&lowbar;ptr` objects&period;

== Synopsis

Declared in `&lt;bdlcc&lowbar;sharedobjectpool&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;
    class TYPE,
    class CREATOR = xref:BloombergLP/bdlcc/ObjectPoolFunctors/DefaultCreator.adoc[ObjectPoolFunctors::DefaultCreator],
    class RESETTER = xref:BloombergLP/bdlcc/ObjectPoolFunctors/Nil.adoc[ObjectPoolFunctors::Nil&lt;TYPE&gt;]&gt;
class SharedObjectPool;
----

== Type Aliases

[cols="1,4"]
|===
| Name| Description
| xref:BloombergLP/bdlcc/SharedObjectPool/CreatorType.adoc[`CreatorType`] 
| Type of the creator functor used by this pool&period;
| xref:BloombergLP/bdlcc/SharedObjectPool/ResetterType.adoc[`ResetterType`] 
| Type of the resetter functor used by this pool&period;
|===


== Member Functions

[cols="1,4"]
|===
| Name| Description
| xref:BloombergLP/bdlcc/SharedObjectPool/2constructor-01.adoc[`SharedObjectPool`]         [.small]#[constructor]#
| Constructors
| xref:BloombergLP/bdlcc/SharedObjectPool/2destructor.adoc[`&#126;SharedObjectPool`] [.small]#[destructor]#
| Destroy this object pool&period; All objects created by this pool are destroyed (even if some of them are still in use) and memory is reclaimed&period;
| xref:BloombergLP/bdlcc/SharedObjectPool/getObject.adoc[`getObject`] 
| Return a pointer to an object from this object pool&period; When the last shared pointer to the object is destroyed, the object will be reset as specified at construction and then returned to the pool&period; If this pool is empty, it is replenished according to the strategy specified at construction&period;
| xref:BloombergLP/bdlcc/SharedObjectPool/increaseCapacity.adoc[`increaseCapacity`] 
| Create the specified `growBy` objects and add them to this object pool&period; The behavior is undefined unless `0 &lt;&equals; growBy`&period;
| xref:BloombergLP/bdlcc/SharedObjectPool/numAvailableObjects.adoc[`numAvailableObjects`] 
| Return a _snapshot_ of the number of objects available in this pool&period;
| xref:BloombergLP/bdlcc/SharedObjectPool/numObjects.adoc[`numObjects`] 
| Return the (instantaneous) number of objects managed by this pool&period; This includes both the objects available in the pool and the objects that were allocated from the pool and not yet released&period;
| xref:BloombergLP/bdlcc/SharedObjectPool/reserveCapacity.adoc[`reserveCapacity`] 
| Create enough objects to satisfy requests for at least the specified `growBy` objects before the next replenishment&period; The behavior is undefined unless `0 &lt;&equals; growBy`&period; Note that this method is different from `increaseCapacity` in that the number of created objects may be less than `growBy`&period;
| xref:BloombergLP/bdlcc/SharedObjectPool/2conversion.adoc[`operator BloombergLP::bslmf::NestedTraitDeclaration&lt;SharedObjectPool, UsesBslmaAllocator&gt;`] 
| Declare that this type uses a `bslma` allocator&period;
|===



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