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

Constructors

== Synopses

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

Create an object pool that dispenses shared pointers to TYPE&period; When the pool is depleted, it increases its capacity according to the optionally specified `growBy` value&period; If `growBy` is positive, the pool always increases by at least `growBy`&period; If `growBy` is negative, the amount of increase begins at `&hyphen;growBy` and then grows geometrically up to an implementation&hyphen;defined maximum&period; The optionally specified `objectCreator` is called whenever objects must be constructed&period; If `objectCreator` is not specified and the parameterized `CREATOR` is the default type (that is, `ObjectPoolFunctors&colon;&colon;DefaultCreator`), a function that calls the default constructor of `TYPE` with placement new, passing this pool&apos;s allocator if TYPE uses allocator, is used&period; If the parameterized `CREATOR` is some other type, and `objectCreator` is not specified, the default value of the `CREATOR` type is used&period; The optionally specified `objectResetter` is invoked with a pointer to an object of `TYPE` when the object is returned to the pool&period; It must reset the object into a valid state for reuse&period; If `objectResetter` is not specified, a default `RESETTER` object is used&period; Optionally specify a basic allocator to supply memory&period; If `basicAllocator` is 0, the currently installed default allocator is used&period; The behavior is undefined if `growBy` is 0&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
explicit
xref:BloombergLP/bdlcc/SharedObjectPool/2constructor-09.adoc[SharedObjectPool](
    int growBy = &hyphen;1,
    xref:BloombergLP/bslma/Allocator.adoc[bslma::Allocator]* basicAllocator = 0);
----

[.small]#xref:BloombergLP/bdlcc/SharedObjectPool/2constructor-09.adoc[_» more&period;&period;&period;_]#

Same as the default constructor, using the specified `objectCreator`&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
explicit
xref:BloombergLP/bdlcc/SharedObjectPool/2constructor-0c.adoc[SharedObjectPool](
    CREATOR const& objectCreator,
    xref:BloombergLP/bslma/Allocator.adoc[bslma::Allocator]* basicAllocator = 0);
----

[.small]#xref:BloombergLP/bdlcc/SharedObjectPool/2constructor-0c.adoc[_» more&period;&period;&period;_]#

Same as the preceding overload, using the specified `growBy`&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
xref:BloombergLP/bdlcc/SharedObjectPool/2constructor-08.adoc[SharedObjectPool](
    CREATOR const& objectCreator,
    int growBy,
    xref:BloombergLP/bslma/Allocator.adoc[bslma::Allocator]* basicAllocator = 0);
----

[.small]#xref:BloombergLP/bdlcc/SharedObjectPool/2constructor-08.adoc[_» more&period;&period;&period;_]#

Same as the preceding overload, using the specified `objectResetter`&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
xref:BloombergLP/bdlcc/SharedObjectPool/2constructor-02.adoc[SharedObjectPool](
    CREATOR const& objectCreator,
    RESETTER const& objectResetter,
    int growBy = &hyphen;1,
    xref:BloombergLP/bslma/Allocator.adoc[bslma::Allocator]* basicAllocator = 0);
----

[.small]#xref:BloombergLP/bdlcc/SharedObjectPool/2constructor-02.adoc[_» more&period;&period;&period;_]#


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