Quick Links:

bal | bbl | bdl | bsl

Static Public Member Functions

bslstl::SharedPtrUtil Struct Reference

#include <bslstl_sharedptr.h>

List of all members.

Static Public Member Functions

static bsl::shared_ptr< char > createInplaceUninitializedBuffer (size_t bufferSize, bslma::Allocator *basicAllocator=0)
template<class TARGET , class SOURCE >
static void constCast (bsl::shared_ptr< TARGET > *target, const bsl::shared_ptr< SOURCE > &source)
template<class TARGET , class SOURCE >
static bsl::shared_ptr< TARGET > constCast (const bsl::shared_ptr< SOURCE > &source) BSLS_KEYWORD_NOEXCEPT
template<class TARGET , class SOURCE >
static void dynamicCast (bsl::shared_ptr< TARGET > *target, const bsl::shared_ptr< SOURCE > &source)
template<class TARGET , class SOURCE >
static bsl::shared_ptr< TARGET > dynamicCast (const bsl::shared_ptr< SOURCE > &source) BSLS_KEYWORD_NOEXCEPT
template<class TARGET , class SOURCE >
static void staticCast (bsl::shared_ptr< TARGET > *target, const bsl::shared_ptr< SOURCE > &source)
template<class TARGET , class SOURCE >
static bsl::shared_ptr< TARGET > staticCast (const bsl::shared_ptr< SOURCE > &source) BSLS_KEYWORD_NOEXCEPT

Detailed Description

This struct provides a namespace for operations on shared pointers.

See Component bslstl_sharedptr


Member Function Documentation

static bsl::shared_ptr<char> bslstl::SharedPtrUtil::createInplaceUninitializedBuffer ( size_t  bufferSize,
bslma::Allocator basicAllocator = 0 
) [static]

Return a shared pointer with an in-place representation holding a newly-created uninitialized buffer of the specified bufferSize (in bytes). Optionally specify a basicAllocator used to supply memory. If basicAllocator is 0, the currently installed default allocator is used. The behavior is undefined unless 0 < bufferSize.

template<class TARGET , class SOURCE >
static void bslstl::SharedPtrUtil::constCast ( bsl::shared_ptr< TARGET > *  target,
const bsl::shared_ptr< SOURCE > &  source 
) [static]

Load into the specified target an aliased shared pointer sharing ownership of the object managed by the specified source shared pointer and referring to const_cast<TARGET *>(source.get()). If *target is already managing a (possibly shared) object, then release the shared reference to that object, and destroy it using its associated deleter if that shared pointer held the last shared reference to that object. Note that a compiler diagnostic will be emitted indicating an error unless const_cast<TARGET *>(source.get()) is a valid expression.

template<class TARGET , class SOURCE >
static bsl::shared_ptr<TARGET> bslstl::SharedPtrUtil::constCast ( const bsl::shared_ptr< SOURCE > &  source  )  [static]

Return a bsl::shared_ptr<TARGET> object sharing ownership of the same object as the specified source shared pointer to the (template parameter) SOURCE type, and referring to const_cast<TARGET *>(source.get()). Note that a compiler diagnostic will be emitted indicating an error unless const_cast<TARGET *>(source.get()) is a valid expression.

template<class TARGET , class SOURCE >
static void bslstl::SharedPtrUtil::dynamicCast ( bsl::shared_ptr< TARGET > *  target,
const bsl::shared_ptr< SOURCE > &  source 
) [static]

Load into the specified target an aliased shared pointer sharing ownership of the object managed by the specified source shared pointer and referring to dynamic_cast<TARGET *>(source.get()). If *target is already managing a (possibly shared) object, then release the shared reference to that object, and destroy it using its associated deleter if that shared pointer held the last shared reference to that object. If 0 == dynamic_cast<TARGET*>(source.get()), then *target shall be reset to an empty state that does not refer to an object. Note that a compiler diagnostic will be emitted indicating an error unless dynamic_cast<TARGET *>(source.get()) is a valid expression.

Referenced by ball::BroadcastObserver::findObserver().

template<class TARGET , class SOURCE >
static bsl::shared_ptr<TARGET> bslstl::SharedPtrUtil::dynamicCast ( const bsl::shared_ptr< SOURCE > &  source  )  [static]

Return a bsl::shared_ptr<TARGET> object sharing ownership of the same object as the specified source shared pointer to the (template parameter) SOURCE type, and referring to dynamic_cast<TARGET *>(source.get()). If that would return a shared pointer referring to nothing (0 == get()), then instead return an (empty) default constructed shared pointer. Note that a compiler diagnostic will be emitted indicating an error unless dynamic_cast<TARGET *>(source.get()) is a valid expression..

template<class TARGET , class SOURCE >
static void bslstl::SharedPtrUtil::staticCast ( bsl::shared_ptr< TARGET > *  target,
const bsl::shared_ptr< SOURCE > &  source 
) [static]

Load into the specified target an aliased shared pointer sharing ownership of the object managed by the specified source shared pointer and referring to static_cast<TARGET *>(source.get()). If *target is already managing a (possibly shared) object, then release the shared reference to that object, and destroy it using its associated deleter if that shared pointer held the last shared reference to that object. Note that a compiler diagnostic will be emitted indicating an error unless static_cast<TARGET *>(source.get()) is a valid expression.

template<class TARGET , class SOURCE >
static bsl::shared_ptr<TARGET> bslstl::SharedPtrUtil::staticCast ( const bsl::shared_ptr< SOURCE > &  source  )  [static]

Return a bsl::shared_ptr<TARGET> object sharing ownership of the same object as the specified source shared pointer to the (template parameter) SOURCE type, and referring to static_cast<TARGET *>(source.get()). Note that a compiler diagnostic will be emitted indicating an error unless static_cast<TARGET *>(source.get()) is a valid expression.


The documentation for this struct was generated from the following file: