BDE 4.14.0 Production release
Loading...
Searching...
No Matches
bslstl_sharedptrallocateinplacerep

Detailed Description

Outline

Purpose

Provide an in-place implementation of bslma::SharedPtrRep.

Classes

Canonical header: bsl_memory.h

See also
bslma_sharedptrrep, bslma_sharedptrinplacerep, bslstl_sharedptr

Description

This component provides a class template, bslstl::SharedPtrAllocateInplaceRep, proving a concrete implementation of bslma::SharedPtrRep for managing objects of the parameterized TYPE that are stored in-place in the representation, and are allocated by an allocator that satisfies the requirements of an Allocator type in the C++11 standard. Thus, only one memory allocation is required to create both the representation and the managed object. When all references to the in-place object are released (using releaseRef), the destructor of TYPE is invoked.

Thread Safety

bslstl::SharedPtrAllocateInplaceRep is thread-safe provided that disposeObject and disposeRep are not called explicitly, meaning that all non-creator operations other than disposeObject and disposeRep on a given instance can be safely invoked simultaneously from multiple threads (disposeObject and disposeRep are meant to be invoked only by releaseRef and releaseWeakRef). Note that there is no thread safety guarantees for operations on the managed object contained in bslstl::SharedPtrAllocateInplaceRep.