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, class ALLOC>
eckit::SharedPtr<T, ALLOC>::SharedPtr(T* ptr) explicit

Parameters
ptr naked pointer

Constructor.

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

Returns true if pointees have the same address

Overloading of "=="

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

Release ownership

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

Reset the ptr

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

Reset the ptr

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

Returns missing documentation

Overloading of "=" with SharedPtr

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

Returns missing documentation

Overloading of "=" with SharedPtr

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

Returns true if pointees have the same address

Overloading of "=="

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

Returns true if pointees have the different address

Overloading of "!="

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

Returns the naked pointer to the object

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

Returns true if it is a unique owner

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

Returns the naked pointer to the object

Overloading of "->"

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

Returns dereferrences the internal pointer

Overloading of "*"