template<class T, class ALLOC = NewDealloc<T>>
eckit::SharedPtr class

A smart pointer that allows to share resources that have derived from Owned

Public types

using element_type = T
using pointer_type = T*

Constructors, destructors, conversion operators

SharedPtr()
Constructor.
SharedPtr(T* ptr) explicit
SharedPtr(const SharedPtr& other)
Copy constructor.
~SharedPtr()
Destructor.
operator bool() const

Public functions

void release()
void reset(T* other)
void reset(const SharedPtr& other)
auto operator=(const SharedPtr& other) -> const SharedPtr&
auto operator=(T* other) -> const SharedPtr&
void swap(SharedPtr& other)
Swap internal pointer with other SharedPtr.
auto operator==(const SharedPtr& other) const -> bool
auto operator!=(const SharedPtr& other) const -> bool
auto get() const -> T*
auto unique() const -> bool
auto operator->() const -> T*
auto operator*() const -> T&
auto owners() const -> size_t
auto use_count() const -> size_t

Function documentation

template<class T _1, class ALLOC>
eckit::SharedPtr<_1, ALLOC>::SharedPtr(T* ptr) explicit

Parameters
ptr naked pointer

Constructor.

template<class T _1, class ALLOC>
eckit::SharedPtr<_1, ALLOC>::operator bool() const

Returns true if pointees have the same address

Overloading of "=="

template<class T _1, class ALLOC>
void eckit::SharedPtr<_1, ALLOC>::release()

Release ownership

template<class T _1, class ALLOC>
void eckit::SharedPtr<_1, ALLOC>::reset(T* other)

Reset the ptr

template<class T _1, class ALLOC>
void eckit::SharedPtr<_1, ALLOC>::reset(const SharedPtr& other)

Reset the ptr

template<class T _1, class ALLOC>
const SharedPtr& eckit::SharedPtr<_1, ALLOC>::operator=(const SharedPtr& other)

Returns missing documentation

Overloading of "=" with SharedPtr

template<class T _1, class ALLOC>
const SharedPtr& eckit::SharedPtr<_1, ALLOC>::operator=(T* other)

Returns missing documentation

Overloading of "=" with SharedPtr

template<class T _1, class ALLOC>
bool eckit::SharedPtr<_1, ALLOC>::operator==(const SharedPtr& other) const

Returns true if pointees have the same address

Overloading of "=="

template<class T _1, class ALLOC>
bool eckit::SharedPtr<_1, ALLOC>::operator!=(const SharedPtr& other) const

Returns true if pointees have the different address

Overloading of "!="

template<class T _1, class ALLOC>
T* eckit::SharedPtr<_1, ALLOC>::get() const

Returns the naked pointer to the object

template<class T _1, class ALLOC>
bool eckit::SharedPtr<_1, ALLOC>::unique() const

Returns true if it is a unique owner

template<class T _1, class ALLOC>
T* eckit::SharedPtr<_1, ALLOC>::operator->() const

Returns the naked pointer to the object

Overloading of "->"

template<class T _1, class ALLOC>
T& eckit::SharedPtr<_1, ALLOC>::operator*() const

Returns dereferrences the internal pointer

Overloading of "*"

This website is beyond its original expiry date and the content may be out of date. The site owner has been notified and may choose to extend the expiry date and remove this banner. If you have any questions about this, please visit our support portal.