#include <atomic>#include <cassert>#include <typeinfo>#include <utility>#include <promeki/core/namespace.h>

Go to the source code of this file.
Classes | |
| class | RefCount |
| An atomic reference count object. More... | |
| class | SharedPtrProxy< T > |
| A proxy class for managing reference counting of objects that do not natively support it. More... | |
| struct | IsSharedObject< T, typename > |
| struct | IsSharedObject< T, std::void_t< decltype(&T::_promeki_refct)> > |
| class | SharedPtr< T, CopyOnWrite, ST > |
| A smart pointer class with reference counting and optional copy-on-write semantics. More... | |
Macros | |
| #define | PROMEKI_SHARED(BASE) |
| Macro to simplify making a base object into a native shared object. | |
| #define | PROMEKI_SHARED_DERIVED(BASE, DERIVED) |
| Macro to simplify making a derived object into a native shared object. | |
| #define | PROMEKI_SHARED_FINAL(TYPE) |
| Macro for non-polymorphic native shared objects. | |
See LICENSE file in the project root folder for license information.
Macro to simplify making a derived object into a native shared object.
This assumes the base class has used PROMEKI_SHARED() macro or otherwise implemented the functionality to be a native shared object.
Example:
Macro for non-polymorphic native shared objects.
Use this instead of PROMEKI_SHARED when the class will never be subclassed (e.g. private inner Data classes). It avoids the overhead of a vtable pointer by using non-virtual _promeki_clone(). The class does not need a virtual destructor.
Example: