memory
|
A pointer to an object where all allocations are joint.
It can either own an object or not (be nullptr
). When it owns an object, it points to a memory block. This memory block contains both the actual object (of the type T
) and space for allocations of T
s members.
The type T
must be derived from joint_type and every constructor must take joint as first parameter. This prevents that you create joint objects yourself, without the additional storage. The default copy and move constructors are also deleted, you need to write them yourself.
You can only access the object through the pointer, use joint_allocator or joint_array as members of T
, to enable the memory sharing. If you are using joint_allocator inside STL containers, make sure that you do not call their regular copy/move constructors, but instead the version where you pass an allocator.
The memory block will be managed by the given RawAllocator, it is stored in an allocator_reference and not owned by the pointer directly.
Typedefs | |
using | element_type = T |
using | allocator_type = typename allocator_reference< RawAllocator >::allocator_type |
Member Functions | |
joint_ptr (joint_ptr &&other) noexcept | |
~joint_ptr () noexcept | |
joint_ptr & | operator= (joint_ptr &&other) noexcept |
joint_ptr & | operator= (std::nullptr_t) noexcept |
void | reset () noexcept |
operator bool () const noexcept | |
element_type & | operator* () const noexcept |
element_type * | operator-> () const noexcept |
element_type * | get () const noexcept |
auto | get_allocator () const noexcept -> decltype(std::declval< allocator_reference< allocator_type > >().get_allocator()) |
joint_ptr (allocator_type &alloc) noexcept | |
joint_ptr (const allocator_type &alloc) noexcept | |
template<typename... Args> | |
joint_ptr (allocator_type &alloc, joint_size additional_size, Args &&... args) | |
template<typename... Args> | |
joint_ptr (const allocator_type &alloc, joint_size additional_size, Args &&... args) | |
|
explicitnoexcept |
|
explicitnoexcept |
joint_ptr | ( | allocator_type & | alloc, |
joint_size | additional_size, | ||
Args &&... | args | ||
) |
joint_ptr | ( | const allocator_type & | alloc, |
joint_size | additional_size, | ||
Args &&... | args | ||
) |
other
to the new object.
|
noexcept |
other
transferred.
|
noexcept |
reset()
.
|
noexcept |
|
explicitnoexcept |
true
if the pointer does own an object, false
otherwise.
|
noexcept |
operator bool()
must return true
.
|
noexcept |
operator bool()
must return true
.
|
noexcept |
nullptr
, if it does not own any object.
|
noexcept |