|
BDE 4.14.0 Production release
|
Provide an in-place implementation of bslma::SharedPtrRep.
bslma::SharedPtrRep implementationThis component provides a concrete implementation of bslma::SharedPtrRep for managing objects of the parameterized TYPE that are stored in-place in the representation . 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.
bslma::SharedPtrInplaceRep 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 bslma::SharedPtrInplaceRep.
The following example demonstrates how to implement a shared bdlt::Datetime using bslma::SharedPtrInplaceRep:
Finally, we define the implementation.