28 template<
typename T,
typename Deleter = std::default_delete<T>>
using UPtr = std::unique_ptr<T, Deleter>;
37 template<
typename T>
using SPtr = std::shared_ptr<T>;
42 template<
typename T>
using WPtr = std::weak_ptr<T>;
46 template<
typename T,
typename... Args> [[
nodiscard]]
inline constexpr T*
ce_new(Args&&... args) {
47 return new T(std::forward<Args>(args)...);
51 return std::make_unique<T>(std::forward<Args>(args)...);
59 void*
const memory = allocator.allocate_node(
sizeof(
T),
alignof(
T));
63 ::new(memory)
T(std::forward<Args>(args)...);
66 return {
result.release(), {allocator}};
70 return std::make_shared<T>(std::forward<Args>(args)...);
73 template<
typename T,
typename Allocator,
typename... Args>
76 return std::allocate_shared<T>(make_std_allocator(make_allocator_reference(allocator)), std::forward<Args>(args)...);
90 template<
typename T,
typename Counter = RefCounter<true>,
typename Deleter = std::default_delete<T>>
class RefCounted;
99 static const constexpr struct AdoptPtrT {
116 CountedPtrTrait<T>::retain(ptr);
117 CountedPtrTrait<T>::release(ptr);
204 if(other.ptr ==
ptr) {
209 ptr = std::exchange(other.ptr,
nullptr);
217 if(other.ptr ==
ptr) {
222 ptr = std::exchange(other.ptr,
nullptr);
264 return std::exchange(
ptr,
nullptr);
368 static void retain(
T* ptr)
noexcept { ptr->retain(); }
372 static void release(
T* ptr)
noexcept { ptr->release(); }
375#define CE_RCPTR_TRAIT_DECL(ClassName) \
376 template<> struct CeresEngine::CountedPtrTrait<ClassName> { \
377 static void retain(ClassName* ptr) noexcept; \
378 static void release(ClassName* ptr) noexcept; \
381#define CE_RCPTR_TRAIT_DEF(ClassName) \
382 void ::CeresEngine::CountedPtrTrait<ClassName>::retain(ClassName* ptr) noexcept { ptr->retain(); } \
383 void ::CeresEngine::CountedPtrTrait<ClassName>::release(ClassName* ptr) noexcept { ptr->release(); }
392 return new T(std::forward<Args>(args)...);
398 template<
bool ThreadSafe = true>
class RefCounter;
459 if(mRefCounter.decrement()) {
460 mDeleter(
static_cast<T*
>(
this));
473 using Deleter = std::default_delete<T>;
480 void retain() noexcept { mRefCounter.increment(); }
484 bool release() noexcept {
485 if(mRefCounter.decrement()) {
486 Deleter{}(
static_cast<T*
>(
this));
569 template<typename U, typename... Args>
571 : mData(ce_shared_new<U>(
std::forward<Args>(args)...),
572 [](const
SPtr<T>& other) ->
SPtr<T> {
return ce_shared_new<U>(
static_cast<const U&
>(*other)); }) {}
576 [[nodiscard]]
bool valid() const noexcept {
return mData.data !=
nullptr; }
579 [[nodiscard]]
explicit operator bool() const noexcept {
return valid(); }
582 [[nodiscard]]
const T*
get() const noexcept {
return mData.data.get(); }
585 [[nodiscard]]
const T&
operator*() const noexcept {
return *get(); }
588 [[nodiscard]]
const T*
operator->() const noexcept {
return get(); }
591 void reset() { mData.data.reset(); }
600 template<
typename Func>
decltype(
auto)
mutate(Func&& func) {
606 return func(*mData.data);
613 if(mData.data.use_count() == 1) {
616 mData.data = mData.copy(mData.data);
653 return CopyOnWritePtr<T>(std::in_place_type_t<U>{}, std::forward<Args>(args)...);
659#define CE_VPTR_TMPL(T) typename T, size_t T##SmallSize
660#define CE_VPTR_TYPE(T) ValuePtr<T, T##SmallSize>
675 template<
typename T,
size_t SmallSize = sizeof(
int*) * 4>
class ValuePtr final {
687 template<
typename U>
static constexpr inline bool isSmall =
sizeof(
U) <= SmallSize;
692 void (*copy)(
void*,
const void*);
693 void (*move)(
void*,
void*);
694 void (*destroy)(
void*);
697 if constexpr(
sizeof(TT) <= SmallSize) {
698 static const VTable vtable{
699 .
get = [](
void* ptr) ->
T* {
return reinterpret_cast<TT*
>(ptr); },
700 .copy = []() ->
decltype(VTable::copy) {
701 if constexpr(std::is_copy_constructible_v<TT>) {
702 return [](
void* destination,
const void* source) {
703 new(destination) TT(*
reinterpret_cast<const TT*
>(source));
708 .
move = []() ->
decltype(VTable::move) {
709 if constexpr(std::is_move_constructible_v<TT>) {
710 return [](
void* destination,
void* source) {
711 new(destination) TT(std::move(*
reinterpret_cast<TT*
>(source)));
716 .destroy = [](
void* ptr) {
reinterpret_cast<TT*
>(ptr)->~TT(); },
720 static const VTable vtable{
721 .
get = [](
void* ptr) ->
T* {
return *
reinterpret_cast<TT**
>(ptr); },
722 .copy = []() ->
decltype(VTable::copy) {
723 if constexpr(std::is_copy_constructible_v<TT>) {
724 return [](
void* destination,
const void* source) {
725 *
reinterpret_cast<TT**
>(destination) =
new TT(**
reinterpret_cast<const TT* const*
>(source));
731 [](
void* destination,
void* source) {
732 *
reinterpret_cast<TT**
>(destination) = std::exchange(*
reinterpret_cast<TT**
>(source),
nullptr);
734 .destroy = [](
void* ptr) {
delete *
reinterpret_cast<TT**
>(ptr); },
743 [[nodiscard]]
bool isCopyable() const noexcept {
return vtable ==
nullptr || vtable->
copy !=
nullptr; }
750 if(vtable ==
nullptr) {
767 if(other.
get() == get()) {
773 if(vtable !=
nullptr) {
782 [[nodiscard]]
bool isMovable() const noexcept {
return vtable ==
nullptr || vtable->
move !=
nullptr; }
789 if(vtable ==
nullptr) {
794 vtable->
move(raw, other.raw);
806 if(other.get() == get()) {
812 vtable = other.vtable;
813 if(vtable !=
nullptr) {
815 vtable->
move(raw, other.raw);
822 ValuePtr(std::nullptr_t) noexcept : vtable(
nullptr) {}
845 template<
typename TT,
typename... Args,
typename = std::enable_if_t<std::is_convertible_v<TT*, T*> && std::is_constructible_v<TT, Args...>>>
847 emplace<TT>(std::forward<Args>(args)...);
852 template<
bool B = std::is_default_constructible_v<T>&& std::is_copy_constructible_v<T>,
typename = std::enable_if_t<B>>
859 template<
typename... Args,
typename = std::enable_if_t<std::is_constructible_v<T, Args...>>>
865 template<
typename TT>
requires(std::is_convertible_v<TT*, T*>)
873 template<
typename TT,
typename... Args,
typename = std::enable_if_t<std::is_constructible_v<TT, Args...>>> TT&
emplace(Args&&... args) {
876 vtable = VTable::template create<TT>();
879 if constexpr(
sizeof(TT) <= SmallSize) {
880 new(raw) TT(std::forward<Args>(args)...);
882 *
reinterpret_cast<TT**
>(raw) =
new TT(std::forward<Args>(args)...);
885 return static_cast<TT&
>(*get());
891 [[nodiscard]]
bool valid()
const {
return vtable !=
nullptr; }
895 [[nodiscard]]
bool empty()
const {
return vtable ==
nullptr; }
898 [[nodiscard]]
T*
get()
const {
return vtable ==
nullptr ? nullptr : vtable->get(raw); }
903 if(vtable ==
nullptr) {
908 vtable->destroy(raw);
911 std::memset(raw, 0x00,
sizeof(raw));
917 explicit operator bool()
const {
return vtable !=
nullptr; }
947 if(lhs.get() ==
nullptr) {
950 if(rhs.get() ==
nullptr) {
953 return *(lhs.get()) == *(rhs.get());
961 if(lhs.get() ==
nullptr) {
964 return *(lhs.get()) == rhs;
972 if(rhs.get() ==
nullptr) {
975 return lhs == *(rhs.get());
983 if(lhs.get() ==
nullptr) {
986 if(rhs.get() ==
nullptr) {
989 return *(lhs.get()) != *(rhs.get());
997 if(lhs.get() ==
nullptr) {
1000 return *(lhs.get()) != rhs;
1008 if(rhs.get() ==
nullptr) {
1011 return lhs != *(rhs.get());
1019 if(lhs.get() ==
nullptr) {
1022 if(rhs.get() ==
nullptr) {
1025 return *(lhs.get()) > *(rhs.get());
1032 template<CE_VPTR_TMPL(T),
typename U>
bool operator>(
const CE_VPTR_TYPE(T) & lhs,
const U& rhs)
noexcept {
1033 if(lhs.get() ==
nullptr) {
1036 return *(lhs.get()) > rhs;
1043 template<
typename U, CE_VPTR_TMPL(T)>
bool operator>(
const U& lhs,
const CE_VPTR_TYPE(T) & rhs)
noexcept {
1044 if(rhs.get() ==
nullptr) {
1047 return lhs > *(rhs.get());
1055 if(lhs.get() ==
nullptr) {
1058 if(rhs.get() ==
nullptr) {
1061 return *(lhs.get()) >= *(rhs.get());
1068 template<CE_VPTR_TMPL(T),
typename U>
bool operator>=(
const CE_VPTR_TYPE(T) & lhs,
const U& rhs)
noexcept {
1069 if(lhs.get() ==
nullptr) {
1072 return *(lhs.get()) >= rhs;
1079 template<
typename U, CE_VPTR_TMPL(T)>
bool operator>=(
const U& lhs,
const CE_VPTR_TYPE(T) & rhs)
noexcept {
1080 if(rhs.get() ==
nullptr) {
1083 return lhs >= *(rhs.get());
1091 if(lhs.get() ==
nullptr) {
1094 if(rhs.get() ==
nullptr) {
1097 return *(lhs.get()) < *(rhs.get());
1104 template<CE_VPTR_TMPL(T),
typename U>
bool operator<(
const CE_VPTR_TYPE(T) & lhs,
const U& rhs)
noexcept {
1105 if(lhs.get() ==
nullptr) {
1108 return *(lhs.get()) < rhs;
1115 template<
typename U, CE_VPTR_TMPL(T)>
bool operator<(
const U& lhs,
const CE_VPTR_TYPE(T) & rhs)
noexcept {
1116 if(rhs.get() ==
nullptr) {
1119 return lhs < *(rhs.get());
1127 if(lhs.get() ==
nullptr) {
1130 if(rhs.get() ==
nullptr) {
1133 return *(lhs.get()) <= *(rhs.get());
1140 template<CE_VPTR_TMPL(T),
typename U>
bool operator<=(
const CE_VPTR_TYPE(T) & lhs,
const U& rhs)
noexcept {
1141 if(lhs.get() ==
nullptr) {
1144 return *(lhs.get()) <= rhs;
1151 template<
typename U, CE_VPTR_TMPL(T)>
bool operator<=(
const U& lhs,
const CE_VPTR_TYPE(T) & rhs)
noexcept {
1152 if(rhs.get() ==
nullptr) {
1155 return lhs <= *(rhs.get());
1161 template<CE_VPTR_TMPL(T)>
bool operator==(
const CE_VPTR_TYPE(T) & lhs, std::nullptr_t)
noexcept {
return lhs.get() ==
nullptr; }
1166 template<CE_VPTR_TMPL(T)>
bool operator!=(
const CE_VPTR_TYPE(T) & lhs, std::nullptr_t)
noexcept {
return lhs.get() !=
nullptr; }
1187template<
typename T>
struct std::hash<
CeresEngine::CountedPtr<T>> {
1189 inline size_t operator()(
const Type& obj)
const noexcept {
return std::hash<T*>{}(obj.get()); }
#define CE_ASSERT(...)
Definition Macros.hpp:323
#define CE_EXPLICIT(EXPR)
Definition Macros.hpp:413
#define CE_VPTR_TYPE(T)
Definition SmartPtr.hpp:660
A copy-on-write pointer type that shares a single instance of an object when copied but allows.
Definition SmartPtr.hpp:510
void reset()
Resets the stored pointer and empties the CoW pointer.
Definition SmartPtr.hpp:591
CopyOnWritePtr & operator=(const CopyOnWritePtr &) noexcept=default
Assigns a copy of the CoW pointer.
decltype(auto) mutate(Func &&func)
Changes the pointer.
Definition SmartPtr.hpp:600
const T * operator->() const noexcept
Gets a const pointer to the object.
Definition SmartPtr.hpp:588
const T * get() const noexcept
Gets a const pointer to the object.
Definition SmartPtr.hpp:582
void makeCopyIfNeeded()
Checks if we are the only user of the CoW pointer.
Definition SmartPtr.hpp:612
bool valid() const noexcept
Checks if the pointer points to a valid object.
Definition SmartPtr.hpp:576
const T & operator*() const noexcept
Gets a const pointer to the object.
Definition SmartPtr.hpp:585
friend bool operator!=(const CopyOnWritePtr &lhs, std::nullptr_t) noexcept
Checks if the two pointers do not point to the same copy of the object.
Definition SmartPtr.hpp:630
friend bool operator==(std::nullptr_t, const CopyOnWritePtr &rhs) noexcept
Checks if the two pointers point to the same copy of the object.
Definition SmartPtr.hpp:633
CopyOnWritePtr(CopyOnWritePtr &&) noexcept=default
Creates a copy of the CoW pointer.
friend bool operator!=(std::nullptr_t, const CopyOnWritePtr &rhs) noexcept
Checks if the two pointers do not point to the same copy of the object.
Definition SmartPtr.hpp:636
friend bool operator==(const CopyOnWritePtr &lhs, const CopyOnWritePtr &rhs) noexcept
Checks if the two pointers point to the same copy of the object.
Definition SmartPtr.hpp:621
friend bool operator==(const CopyOnWritePtr &lhs, std::nullptr_t) noexcept
Checks if the two pointers point to the same copy of the object.
Definition SmartPtr.hpp:627
friend bool operator!=(const CopyOnWritePtr &lhs, const CopyOnWritePtr &rhs) noexcept
Checks if the two pointers do not point to the same copy of the object.
Definition SmartPtr.hpp:624
CopyOnWritePtr(const CopyOnWritePtr &) noexcept=default
Creates a copy of the CoW pointer.
A retain-release type of smart pointer.
Definition SmartPtr.hpp:132
friend bool operator==(const CountedPtr< U1 > &a, const CountedPtr< U2 > &b) noexcept
Checks if both intrusive pointers represent the same object.
Definition SmartPtr.hpp:495
friend bool operator!=(const CountedPtr< U1 > &a, const CountedPtr< U2 > &b) noexcept
Checks if both intrusive pointers not represent the same object.
Definition SmartPtr.hpp:496
void set(Pointer newPtr) noexcept
Sets a new value for the pointer.
Definition SmartPtr.hpp:274
friend bool operator!=(const CountedPtr< U > &a, std::nullptr_t) noexcept
Checks if the intrusive pointer a is not nullptr.
Definition SmartPtr.hpp:502
CountedPtr(AdoptPtrT, const Pointer aPtr) noexcept
Creates a new CountedPtr from an existing reference counted object.
Definition SmartPtr.hpp:165
CountedPtrTrait< T > Trait
The CountedPtrTrait specialization for type T.
Definition SmartPtr.hpp:136
~CountedPtr() noexcept
Destroys the CountedPtr.
Definition SmartPtr.hpp:240
CountedPtr & operator=(const CountedPtr< U > &other) noexcept
Assigns the CountedPtr by copying another.
Definition SmartPtr.hpp:186
friend bool operator==(const U1 *a, const CountedPtr< U2 > &b) noexcept
Checks if both intrusive pointers represent the same object.
Definition SmartPtr.hpp:499
friend bool operator!=(const CountedPtr< U1 > &a, const U2 *b) noexcept
Checks if both intrusive pointers not represent the same object.
Definition SmartPtr.hpp:498
CountedPtr() noexcept=default
Creates a new null CountedPtr
CountedPtr(CountedPtr &&other) noexcept
Creates a new CountedPtr by moving another.
Definition SmartPtr.hpp:193
CountedPtr & operator=(CountedPtr &&other) noexcept
Assigns the CountedPtr by moving another.
Definition SmartPtr.hpp:203
friend bool operator==(const CountedPtr< U1 > &a, const U2 *b) noexcept
Checks if both intrusive pointers represent the same object.
Definition SmartPtr.hpp:497
friend bool operator==(const CountedPtr< U > &a, std::nullptr_t) noexcept
Checks if the intrusive pointer a is nullptr.
Definition SmartPtr.hpp:501
Reference operator*() const noexcept
Definition SmartPtr.hpp:250
CountedPtr(CountedPtr< U > &&other) noexcept
Creates a new CountedPtr by copying another.
Definition SmartPtr.hpp:197
T * Pointer
A pointer to the reference counted object.
Definition SmartPtr.hpp:143
void reset() noexcept
Resets the pointer by setting it to nullptr.
Definition SmartPtr.hpp:257
static CountedPtr< T > adopt(T *const ptr)
Creates a new CountedPtr from an existing reference counted object.
Definition SmartPtr.hpp:269
Pointer release() noexcept
Releases the pointer from the CountedPtr.
Definition SmartPtr.hpp:262
Pointer operator->() const noexcept
Definition SmartPtr.hpp:247
CountedPtr & operator=(const CountedPtr &other) noexcept
Assigns the CountedPtr by copying another.
Definition SmartPtr.hpp:178
friend bool operator!=(const U1 *a, const CountedPtr< U2 > &b) noexcept
Checks if both intrusive pointers not represent the same object.
Definition SmartPtr.hpp:500
CountedPtr(const CountedPtr &other) noexcept
Creates a new CountedPtr by copying another.
Definition SmartPtr.hpp:169
CountedPtr(const CountedPtr< U > &other) noexcept
Creates a new CountedPtr by copying another.
Definition SmartPtr.hpp:173
CountedPtr(std::nullptr_t) noexcept
Creates a new empty CountedPtr object.
Definition SmartPtr.hpp:161
CountedPtr & operator=(U *aPtr) noexcept
Assigns the CountedPtr by assigning a new pointer.
Definition SmartPtr.hpp:230
Pointer get() const noexcept
Definition SmartPtr.hpp:244
Pointer ptr
The raw-pointer to the reference counted object.
Definition SmartPtr.hpp:150
T & Reference
A reference to the reference counted object.
Definition SmartPtr.hpp:146
CountedPtr & operator=(CountedPtr< U > &&other) noexcept
Assigns the CountedPtr by copying another.
Definition SmartPtr.hpp:216
T ElementType
The element type contained by the pointer.
Definition SmartPtr.hpp:140
A simple reference counter base class.
Definition SmartPtr.hpp:438
Counter mRefCounter
The object's reference counter.
Definition SmartPtr.hpp:440
void retain() noexcept
Retains the object by increment it's reference count by one.
Definition SmartPtr.hpp:454
RefCounted(Args &&... args)
Creates a new RefCounted object and constructs a new Deleter by forwarding Args to it.
Definition SmartPtr.hpp:450
Deleter mDeleter
The deleter object type.
Definition SmartPtr.hpp:443
bool release() noexcept
Relases the object by decrementing it's reference count by one.
Definition SmartPtr.hpp:458
RefCounter(const UInt64 initialCount)
Definition SmartPtr.hpp:427
void increment() noexcept
Increments the reference counter by one.
void increment() noexcept
Increments the reference counter by one.
RefCounter(const UInt64 initialCount)
Definition SmartPtr.hpp:408
A class that implements a simple interface for reference counting.
Definition SmartPtr.hpp:82
A pointer type that has value semantics.
Definition SmartPtr.hpp:675
UInt8 raw[SmallSize]
The underlying storage memory.
Definition SmartPtr.hpp:683
void reset()
Resets the stored object into an empty state.
Definition SmartPtr.hpp:902
ValuePtr(const ValuePtr &other)
Creates a new ValuePtr by copying an existing one.
Definition SmartPtr.hpp:747
const VTable * vtable
A VTable that contains implementation for copy, move and destroy.
Definition SmartPtr.hpp:680
ValuePtr(ValuePtr &&other) noexcept
Creates a new ValuePtr by moving an existing one.
Definition SmartPtr.hpp:786
ValuePtr(ConstructTag< TT >, Args &&... args)
Creates a new ValuePtr that holds a newly constructed object of type TT.
Definition SmartPtr.hpp:846
bool empty() const
Checks if the pointer has a valid object stored in it.
Definition SmartPtr.hpp:895
ValuePtr(Args &&... args)
Creates a new ValuePtr that holds a newly constructed object of type T.
Definition SmartPtr.hpp:860
~ValuePtr() noexcept
Destroys the ValuePtr and destroys the object is present.
Definition SmartPtr.hpp:832
ValuePtr & operator=(std::nullptr_t) noexcept
Assigns the ValuePtr a nullptr value.
Definition SmartPtr.hpp:826
ValuePtr() noexcept
Creates a new empty ValuePtr.
Definition SmartPtr.hpp:853
T & operator*() const
Definition SmartPtr.hpp:923
TT & emplace(Args &&... args)
Emplace a new object of type TT into the ValuePtr.
Definition SmartPtr.hpp:873
T * operator->() const
Definition SmartPtr.hpp:920
static ValuePtr< T, SmallSize > create(Args &&... args)
Create a new ValuePtr with an object of type U
Definition SmartPtr.hpp:937
ValuePtr(std::nullptr_t) noexcept
Creates a new empty ValuePtr.
Definition SmartPtr.hpp:822
bool isMovable() const noexcept
Checks if the ValuePtr move constructor can be safely called.
Definition SmartPtr.hpp:782
ValuePtr(TT object)
Creates a new ValuePtr that holds a copy constructed object of type TT.
Definition SmartPtr.hpp:866
bool isCopyable() const noexcept
Checks if the ValuePtr copy constructor can be safely called.
Definition SmartPtr.hpp:743
static ValuePtr< T, SmallSize > create(Args &&... args)
Create a new ValuePtr with an object of type T
Definition SmartPtr.hpp:930
bool valid() const
Checks if the pointer has a valid object stored in it.
Definition SmartPtr.hpp:891
ValuePtr & operator=(ValuePtr &&other)
Assigns a ValuePtr by moving an existing one.
Definition SmartPtr.hpp:800
ValuePtr & operator=(const ValuePtr &other)
Assigns a ValuePtr by copying an existing one.
Definition SmartPtr.hpp:761
T * get() const
Definition SmartPtr.hpp:898
A concept type that checks if a given type T has a intrusive retain
Definition SmartPtr.hpp:106
A concept type that checks if a given type T has a CountedPtrTrait specialization that allows it to b...
Definition SmartPtr.hpp:115
Definition Application.hpp:19
std::unique_ptr< T, Deleter > UPtr
UPtr is a smart pointer that owns and manages another object through a pointer and disposes of that o...
Definition SmartPtr.hpp:28
std::uint64_t UInt64
Definition DataTypes.hpp:26
std::shared_ptr< T > SPtr
SPtr is a smart pointer that retains shared ownership of an object through a pointer.
Definition SmartPtr.hpp:37
constexpr UPtr< T > ce_unique_new(Args &&... args)
Definition SmartPtr.hpp:50
CopyOnWritePtr< T > ce_cow_new(Args &&... args)
Creates a new copy-on-write pointer by constructing a new object of type U.
Definition SmartPtr.hpp:652
auto move(Vector3 position)
Moves a entity to the given position.
Definition Helpers.hpp:22
bool operator!=(const ShortAllocator< T, N, A1 > &x, const ShortAllocator< U, M, A2 > &y) noexcept
Definition Allocator.hpp:416
RC< T > ce_counted_new(Args &&... args)
Definition SmartPtr.hpp:391
std::uint8_t UInt8
Definition DataTypes.hpp:17
constexpr SPtr< T > ce_shared_new(Args &&... args)
Definition SmartPtr.hpp:69
bool operator==(const ShortAllocator< T, N, A1 > &x, const ShortAllocator< U, M, A2 > &y) noexcept
Definition Allocator.hpp:411
constexpr SPtr< T > ce_shared_alloc(Allocator &allocator, Args &&... args)
Definition SmartPtr.hpp:74
std::atomic< T > Atomic
The Atomic template defines an atomic type.
Definition Atomic.hpp:16
constexpr T * ce_new(Args &&... args)
Definition SmartPtr.hpp:46
std::weak_ptr< T > WPtr
WPtr is a smart pointer that holds a non-owning ("weak") reference to an object that is managed by SP...
Definition SmartPtr.hpp:42
void copy(const A &a, B &b, T &&t=T())
Copies values from one container to another.
Definition Iterator.hpp:564
constexpr size_t hash(const T &v)
Generates a hash for the provided type.
Definition Hash.hpp:25
constexpr UPtr< T, AllocatorDeleter< T, RawAllocator > > ce_unique_alloc(RawAllocator &allocator, Args &&... args)
Definition SmartPtr.hpp:55
RC< T > ce_counted_adopt(T *const ptr)
Definition SmartPtr.hpp:387
Definition SmartPtr.hpp:514
Data(const Data &)=default
Data(const SPtr< T > &data, SPtr< T >(*copy)(const SPtr< T > &))
Definition SmartPtr.hpp:523
Data & operator=(const Data &)=default
Data(Data &&) noexcept=default
A trait template class that can be specialized for custom types.
Definition SmartPtr.hpp:95
A tag used for tagged dispatching the object constructing constructor.
Definition SmartPtr.hpp:838
Definition SmartPtr.hpp:690
T *(* get)(void *)
Definition SmartPtr.hpp:691
void(* move)(void *, void *)
Definition SmartPtr.hpp:693
static const VTable * create()
Definition SmartPtr.hpp:696
void(* copy)(void *, const void *)
Definition SmartPtr.hpp:692