[#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 `<bdlcc_sharedobjectpool.h>` Create an object pool that dispenses shared pointers to TYPE. When the pool is depleted, it increases its capacity according to the optionally specified `growBy` value. If `growBy` is positive, the pool always increases by at least `growBy`. If `growBy` is negative, the amount of increase begins at `‐growBy` and then grows geometrically up to an implementation‐defined maximum. The optionally specified `objectCreator` is called whenever objects must be constructed. If `objectCreator` is not specified and the parameterized `CREATOR` is the default type (that is, `ObjectPoolFunctors::DefaultCreator`), a function that calls the default constructor of `TYPE` with placement new, passing this pool's allocator if TYPE uses allocator, is used. If the parameterized `CREATOR` is some other type, and `objectCreator` is not specified, the default value of the `CREATOR` type is used. The optionally specified `objectResetter` is invoked with a pointer to an object of `TYPE` when the object is returned to the pool. It must reset the object into a valid state for reuse. If `objectResetter` is not specified, a default `RESETTER` object is used. Optionally specify a basic allocator to supply memory. If `basicAllocator` is 0, the currently installed default allocator is used. The behavior is undefined if `growBy` is 0. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- explicit xref:BloombergLP/bdlcc/SharedObjectPool/2constructor-09.adoc[SharedObjectPool]( int growBy = ‐1, xref:BloombergLP/bslma/Allocator.adoc[bslma::Allocator]* basicAllocator = 0); ---- [.small]#xref:BloombergLP/bdlcc/SharedObjectPool/2constructor-09.adoc[_» more..._]# Same as the default constructor, using the specified `objectCreator`. [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..._]# Same as the preceding overload, using the specified `growBy`. [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..._]# Same as the preceding overload, using the specified `objectResetter`. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- xref:BloombergLP/bdlcc/SharedObjectPool/2constructor-02.adoc[SharedObjectPool]( CREATOR const& objectCreator, RESETTER const& objectResetter, int growBy = ‐1, xref:BloombergLP/bslma/Allocator.adoc[bslma::Allocator]* basicAllocator = 0); ---- [.small]#xref:BloombergLP/bdlcc/SharedObjectPool/2constructor-02.adoc[_» more..._]# [.small]#Created with https://www.mrdocs.com[MrDocs]#