Constructors
Declared in <bslstl_sharedptr.h>
Create an empty shared pointer, i.e., a shared pointer with no representation that does not refer to any object and has no deleter.
constexpr
shared_ptr() noexcept;
» more...
Copy-construct a shared_ptr from original.
shared_ptr(shared_ptr const& original) noexcept;
» more...
Create a shared_ptr sharing ownership with a compatible other.
template<class COMPATIBLE_TYPE>
shared_ptr(shared_ptr<COMPATIBLE_TYPE> const& other) noexcept;
» more...
Move-construct a shared_ptr from a compatible other.
template<class COMPATIBLE_TYPE>
shared_ptr(shared_ptr<COMPATIBLE_TYPE>&& other) noexcept;
» more...
Create an empty shared pointer, i.e., a shared pointer with no representation that does not refer to any object and has no deleter.
constexpr
shared_ptr(bsl::nullptr_t nullPointerLiteral) noexcept;
» more...
Move-construct a shared_ptr from original.
shared_ptr(BloombergLP::bslmf::MovableRef<shared_ptr> original) noexcept;
» more...
Create a shared_ptr from a weak_ptr, or empty if expired.
template<class COMPATIBLE_TYPE>
explicit
shared_ptr(weak_ptr<COMPATIBLE_TYPE> const& ptr);
» more...
Create a shared_ptr that manages the object at ptr.
template<class CONVERTIBLE_TYPE>
explicit
shared_ptr(CONVERTIBLE_TYPE* ptr);
» more...
Create an empty shared pointer.
shared_ptr(
nullptr_t nullPointerLiteral,
BloombergLP::bslma::Allocator* basicAllocator);
» more...
Create a shared_ptr from the specified arguments.
explicit
shared_ptr(
std::auto_ptr_ref<ELEMENT_TYPE> autoRef,
BloombergLP::bslma::Allocator* basicAllocator = 0);
» more...
Create a shared_ptr from the specified arguments.
shared_ptr(
element_type* ptr,
BloombergLP::bslma::SharedPtrRep* rep);
» more...
Create a shared_ptr by adopting ownership from a managed pointer.
template<class CONVERTIBLE_TYPE>
shared_ptr(
BloombergLP::bslma::ManagedPtr<CONVERTIBLE_TYPE> managedPtr,
BloombergLP::bslma::Allocator* basicAllocator = 0);
» more...
Create a shared_ptr from the specified arguments.
template<class CONVERTIBLE_TYPE>
explicit
shared_ptr(
std::auto_ptr<CONVERTIBLE_TYPE>& autoPtr,
BloombergLP::bslma::Allocator* basicAllocator = 0);
» more...
Create an aliased shared_ptr sharing ownership with source.
template<class ANY_TYPE>
shared_ptr(
shared_ptr<ANY_TYPE> const& source,
ELEMENT_TYPE* object) noexcept;
» more...
Create a shared_ptr managing ptr using basicAllocator.
template<class CONVERTIBLE_TYPE>
shared_ptr(
CONVERTIBLE_TYPE* ptr,
BloombergLP::bslma::Allocator* basicAllocator);
» more...
Create a shared_ptr by adopting ownership from a unique pointer.
template<
class COMPATIBLE_TYPE,
class UNIQUE_DELETER>
requires is_convertible<
typename std::unique_ptr<COMPATIBLE_TYPE,
UNIQUE_DELETER>::pointer,
ELEMENT_TYPE *>::value
shared_ptr(
std::unique_ptr<COMPATIBLE_TYPE, UNIQUE_DELETER>&& adoptee,
BloombergLP::bslma::Allocator* basicAllocator = 0);
» more...
Create a shared_ptr managing ptr with a custom deleter.
template<
class CONVERTIBLE_TYPE,
class DELETER>
shared_ptr(
CONVERTIBLE_TYPE* ptr,
DELETER* deleter);
» more...
Create a shared_ptr from the specified arguments.
shared_ptr(
ELEMENT_TYPE* ptr,
BloombergLP::bslma::SharedPtrRep* rep,
BloombergLP::bslstl::SharedPtr_RepFromExistingSharedPtr tag);
» more...
Create a shared_ptr owning null with a deleter.
template<class DELETER>
shared_ptr(
nullptr_t nullPointerLiteral,
DELETER deleter,
BloombergLP::bslma::Allocator* basicAllocator = 0);
» more...
Create a shared_ptr managing ptr with a deleter and allocator.
template<
class CONVERTIBLE_TYPE,
class DELETER>
shared_ptr(
CONVERTIBLE_TYPE* ptr,
DELETER deleter,
BloombergLP::bslma::Allocator* basicAllocator = 0);
» more...
Create a shared_ptr owning null with a deleter and allocator.
template<
class DELETER,
class ALLOCATOR>
shared_ptr(
nullptr_t nullPointerLiteral,
DELETER deleter,
ALLOCATOR basicAllocator,
ALLOCATOR::value_type* sfinae = 0);
» more...
Create a shared_ptr managing ptr with a custom deleter.
template<
class CONVERTIBLE_TYPE,
class DELETER,
class ALLOCATOR>
shared_ptr(
CONVERTIBLE_TYPE* ptr,
DELETER deleter,
ALLOCATOR basicAllocator,
ALLOCATOR::value_type* sfinae = 0);
» more...
| Name | Description |
|---|---|
| original | source object to copy or move from |
| other | other pointer to compare or share ownership with |
| nullPointerLiteral | null-pointer literal (unused; selects this overload) |
| ptr | pointer to the object to manage or refer to |
| basicAllocator | allocator used to supply memory |
| rep | shared-pointer representation object |
| managedPtr | managed pointer whose ownership is transferred |
| source | source shared pointer that supplies ownership |
| object | object to refer to while sharing ownership with source |
| adoptee | unique pointer whose ownership is transferred |
| deleter | deleter invoked when the last shared reference is released |
| tag | tag selecting the existing-representation constructor |
| sfinae | unused SFINAE discriminator |