Skip to content

aui::Arc#

An std::shared_ptr with AUI extensions.

Header:#include <AUI/Common/SharedPtrTypes.h>
CMake:aui_link(my_target PUBLIC aui::core)

Detailed Description#

Note

Of course, it is not good tone to define a class with _ type but it significantly increases coding speed. Instead of writing every time std::shared_ptr you should write only the _ symbol.

Arc stands for atomic reference counter

Public Methods#

constructor#


Arc::Arc(const std::shared_ptr<T>& v)

Constructs a shared_ptr which shares ownership of the object managed by v.

Constructs a shared_ptr which shares ownership of the object managed by v. If v manages no object, *this manages no object either.


Arc::Arc(std::shared_ptr<T >&& v)

Move-constructs a shared_ptr from v.

After the construction, *this contains a copy of the previous state of v, v is empty and its stored pointer is null.

In comparison to copy-constructing, the move-constructor is cheaper, as it does not require an atomic operation.


Arc::Arc(const Arc& v)

Constructs a shared_ptr which shares ownership of the object managed by v.

Constructs a shared_ptr which shares ownership of the object managed by v. If v manages no object, *this manages no object either.


Arc::Arc(Arc&& v)

Move-constructs a shared_ptr from v.

After the construction, *this contains a copy of the previous state of v, v is empty and its stored pointer is null.

In comparison to copy-constructing, the move-constructor is cheaper, as it does not require an atomic operation.


Arc::Arc(const std::weak_ptr<T>& v)

Constructs a shared_ptr which shares ownership of the object managed by v.

Throws std::bad_weak_ptr if expired.


Arc::Arc(const WeakArc<T>& v)

Constructs a shared_ptr which shares ownership of the object managed by v.

Throws std::bad_weak_ptr if expired.