Compare commits
2 Commits
37bb7e805e
...
0b8fbafdca
Author | SHA1 | Date | |
---|---|---|---|
0b8fbafdca | |||
bdb5e3e37a |
14
Include/auROXTL/MemoryModel/auArraySize.hpp
Normal file
14
Include/auROXTL/MemoryModel/auArraySize.hpp
Normal file
@ -0,0 +1,14 @@
|
||||
/***
|
||||
Copyright (C) 2023-2024 Jamie Reece Wilson (a/k/a "Reece"). All rights reserved.
|
||||
|
||||
File: auArraySize.hpp
|
||||
Date: 2022-02-01 - 2024-09-09
|
||||
Author: Reece
|
||||
***/
|
||||
#pragma once
|
||||
|
||||
template <class T, AuUInt Z>
|
||||
constexpr AuUInt AuArraySize(const T(&array)[Z])
|
||||
{
|
||||
return Z;
|
||||
}
|
16
Include/auROXTL/MemoryModel/auOffsetOf.hpp
Normal file
16
Include/auROXTL/MemoryModel/auOffsetOf.hpp
Normal file
@ -0,0 +1,16 @@
|
||||
/***
|
||||
Copyright (C) 2023-2024 Jamie Reece Wilson (a/k/a "Reece"). All rights reserved.
|
||||
|
||||
File: auOffsetOf.hpp
|
||||
Date: 2023-02-04 - 2024-09-09
|
||||
Author: Reece
|
||||
***/
|
||||
#pragma once
|
||||
|
||||
template <typename T, typename C>
|
||||
AuUInt AuOffsetOf(C T:: *offset)
|
||||
{
|
||||
return AuUInt(
|
||||
&(((const T *)(nullptr))->*offset)
|
||||
);
|
||||
}
|
20
Include/auROXTL/MemoryModel/auSetAllocator.hpp
Normal file
20
Include/auROXTL/MemoryModel/auSetAllocator.hpp
Normal file
@ -0,0 +1,20 @@
|
||||
/***
|
||||
Copyright (C) 2024 Jamie Reece Wilson (a/k/a "Reece"). All rights reserved.
|
||||
|
||||
File: auSetAllocator.hpp
|
||||
Date: 2024-09-09
|
||||
Author: Reece
|
||||
***/
|
||||
#pragma once
|
||||
|
||||
namespace Aurora::Memory
|
||||
{
|
||||
struct Heap;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
static bool AuSetAllocator(T &that, Aurora::Memory::Heap *pHeap);
|
||||
|
||||
template <typename T>
|
||||
static bool AuSetAllocator(T &that, const AuSPtr<Aurora::Memory::Heap> &pHeap);
|
||||
|
533
Include/auROXTL/MemoryModel/auSetAllocator.ipp
Normal file
533
Include/auROXTL/MemoryModel/auSetAllocator.ipp
Normal file
@ -0,0 +1,533 @@
|
||||
/***
|
||||
Copyright (C) 2024 Jamie Reece Wilson (a/k/a "Reece"). All rights reserved.
|
||||
|
||||
File: auSetAllocator.ipp
|
||||
Date: 2024-09-09
|
||||
Author: Reece
|
||||
***/
|
||||
#pragma once
|
||||
|
||||
namespace __audetail
|
||||
{
|
||||
template <class T>
|
||||
struct AuHasSetAllocatorRawVoid
|
||||
{
|
||||
template <class C> static constexpr AuTrueType Test(decltype(static_cast<void (C:: *)(Aurora::Memory::Heap *)>(&C::SetAllocator)));
|
||||
template <class C> static constexpr AuFalseType Test(...);
|
||||
using type = decltype(Test<T>(0));
|
||||
};
|
||||
|
||||
template <class T>
|
||||
struct AuHasSetAllocatorRawBool
|
||||
{
|
||||
template <class C> static constexpr AuTrueType Test(decltype(static_cast<bool (C:: *)(Aurora::Memory::Heap *)>(&C::SetAllocator)));
|
||||
template <class C> static constexpr AuFalseType Test(...);
|
||||
using type = decltype(Test<T>(0));
|
||||
};
|
||||
template <class T>
|
||||
struct AuHasSetHeapRawVoid
|
||||
{
|
||||
template <class C> static constexpr AuTrueType Test(decltype(static_cast<void (C:: *)(Aurora::Memory::Heap *)>(&C::SetHeap)));
|
||||
template <class C> static constexpr AuFalseType Test(...);
|
||||
using type = decltype(Test<T>(0));
|
||||
};
|
||||
|
||||
template <class T>
|
||||
struct AuHasSetHeapRawBool
|
||||
{
|
||||
template <class C> static constexpr AuTrueType Test(decltype(static_cast<bool (C:: *)(Aurora::Memory::Heap *)>(&C::SetHeap)));
|
||||
template <class C> static constexpr AuFalseType Test(...);
|
||||
using type = decltype(Test<T>(0));
|
||||
};
|
||||
template <class T>
|
||||
struct AuHasSetAllocatorSVoid
|
||||
{
|
||||
template <class C> static constexpr AuTrueType Test(decltype(static_cast<void (C:: *)(AuSPtr<Aurora::Memory::Heap>)>(&C::SetAllocator)));
|
||||
template <class C> static constexpr AuTrueType Test(decltype(static_cast<void (C:: *)(const AuSPtr<Aurora::Memory::Heap> &)>(&C::SetAllocator)));
|
||||
template <class C> static constexpr AuFalseType Test(...);
|
||||
using type = decltype(Test<T>(0));
|
||||
};
|
||||
|
||||
template <class T>
|
||||
struct AuHasSetAllocatorSBool
|
||||
{
|
||||
template <class C> static constexpr AuTrueType Test(decltype(static_cast<bool (C:: *)(AuSPtr<Aurora::Memory::Heap>)>(&C::SetAllocator)));
|
||||
template <class C> static constexpr AuTrueType Test(decltype(static_cast<bool (C:: *)(const AuSPtr<Aurora::Memory::Heap> &)>(&C::SetAllocator)));
|
||||
template <class C> static constexpr AuFalseType Test(...);
|
||||
using type = decltype(Test<T>(0));
|
||||
};
|
||||
|
||||
template <class T>
|
||||
struct AuHasSetHeapSVoid
|
||||
{
|
||||
template <class C> static constexpr AuTrueType Test(decltype(static_cast<void (C:: *)(AuSPtr<Aurora::Memory::Heap>)>(&C::SetHeap)));
|
||||
template <class C> static constexpr AuTrueType Test(decltype(static_cast<void (C:: *)(const AuSPtr<Aurora::Memory::Heap> &)>(&C::SetHeap)));
|
||||
template <class C> static constexpr AuFalseType Test(...);
|
||||
using type = decltype(Test<T>(0));
|
||||
};
|
||||
|
||||
template <class T>
|
||||
struct AuHasSetHeapSBool
|
||||
{
|
||||
template <class C> static constexpr AuTrueType Test(decltype(static_cast<bool (C:: *)(AuSPtr<Aurora::Memory::Heap>)>(&C::SetHeap)));
|
||||
template <class C> static constexpr AuTrueType Test(decltype(static_cast<bool (C:: *)(const AuSPtr<Aurora::Memory::Heap> &)>(&C::SetHeap)));
|
||||
template <class C> static constexpr AuFalseType Test(...);
|
||||
using type = decltype(Test<T>(0));
|
||||
};
|
||||
|
||||
template <class T>
|
||||
struct AuHasSetHeapSharedSVoid
|
||||
{
|
||||
template <class C> static constexpr AuTrueType Test(decltype(static_cast<void (C:: *)(AuSPtr<Aurora::Memory::Heap>)>(&C::SetHeapShared)));
|
||||
template <class C> static constexpr AuTrueType Test(decltype(static_cast<void (C:: *)(const AuSPtr<Aurora::Memory::Heap> &)>(&C::SetHeapShared)));
|
||||
template <class C> static constexpr AuFalseType Test(...);
|
||||
using type = decltype(Test<T>(0));
|
||||
};
|
||||
|
||||
template <class T>
|
||||
struct AuHasSetHeapSharedSBool
|
||||
{
|
||||
template <class C> static constexpr AuTrueType Test(decltype(static_cast<bool (C:: *)(AuSPtr<Aurora::Memory::Heap>)>(&C::SetHeapShared)));
|
||||
template <class C> static constexpr AuTrueType Test(decltype(static_cast<bool (C:: *)(const AuSPtr<Aurora::Memory::Heap> &)>(&C::SetHeapShared)));
|
||||
template <class C> static constexpr AuFalseType Test(...);
|
||||
using type = decltype(Test<T>(0));
|
||||
};
|
||||
|
||||
template <class T>
|
||||
struct AuHasAllocatorType
|
||||
{
|
||||
template <class C> static constexpr AuTrueType Test(typename C::allocator_type *);
|
||||
template <class C> static constexpr AuFalseType Test(...);
|
||||
using type = decltype(Test<T>(0));
|
||||
};
|
||||
|
||||
template <class T>
|
||||
constexpr inline bool AuHasSetAllocatorRawVoid_v = AuHasSetAllocatorRawVoid<T>::type::value;
|
||||
|
||||
template <class T>
|
||||
constexpr inline bool AuHasSetAllocatorRawBool_v = AuHasSetAllocatorRawBool<T>::type::value;
|
||||
|
||||
template <class T>
|
||||
constexpr inline bool AuHasSetAllocatorSharedVoid_v = AuHasSetAllocatorSVoid<T>::type::value;
|
||||
|
||||
template <class T>
|
||||
constexpr inline bool AuHasSetAllocatorSharedBool_v = AuHasSetAllocatorSBool<T>::type::value;
|
||||
|
||||
template <class T>
|
||||
constexpr inline bool AuHasSetHeapRawVoid_v = AuHasSetHeapRawVoid<T>::type::value;
|
||||
|
||||
template <class T>
|
||||
constexpr inline bool AuHasSetHeapRawBool_v = AuHasSetHeapRawBool<T>::type::value;
|
||||
|
||||
template <class T>
|
||||
constexpr inline bool AuHasSetHeapSharedVoid_v = AuHasSetHeapSVoid<T>::type::value;
|
||||
|
||||
template <class T>
|
||||
constexpr inline bool AuHasSetHeapSharedBool_v = AuHasSetHeapSBool<T>::type::value;
|
||||
|
||||
template <class T>
|
||||
constexpr inline bool AuHasSetHeapSharedSharedVoid_v = AuHasSetHeapSharedSVoid<T>::type::value;
|
||||
|
||||
template <class T>
|
||||
constexpr inline bool AuHasSetHeapSharedSharedBool_v = AuHasSetHeapSharedSBool<T>::type::value;
|
||||
|
||||
template <class T>
|
||||
constexpr inline bool AuHasAllocatorType_v = AuHasAllocatorType<T>::type::value;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
static bool AuSetAllocator(T &that, Aurora::Memory::Heap *pHeap)
|
||||
{
|
||||
if (!pHeap)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if constexpr (__audetail::AuHassize_v<T>)
|
||||
{
|
||||
if constexpr (__audetail::AuHasSetAllocatorRawVoid_v<T>)
|
||||
{
|
||||
if (that.size())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
that.SetAllocator(pHeap);
|
||||
return true;
|
||||
}
|
||||
|
||||
if constexpr (__audetail::AuHasSetAllocatorRawBool_v<T>)
|
||||
{
|
||||
if (that.size())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return that.SetAllocator(pHeap);
|
||||
}
|
||||
|
||||
if constexpr (__audetail::AuHasSetHeapRawVoid_v<T>)
|
||||
{
|
||||
if (that.size())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
that.SetHeap(pHeap);
|
||||
return true;
|
||||
}
|
||||
|
||||
if constexpr (__audetail::AuHasSetHeapRawBool_v<T>)
|
||||
{
|
||||
if (that.size())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return that.SetHeap(pHeap);
|
||||
}
|
||||
|
||||
if constexpr (__audetail::AuHasSetAllocatorSharedVoid_v<T>)
|
||||
{
|
||||
if (that.size())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
that.SetAllocator(AuUnsafeRaiiToShared(pHeap));
|
||||
return true;
|
||||
}
|
||||
|
||||
if constexpr (__audetail::AuHasSetAllocatorSharedBool_v<T>)
|
||||
{
|
||||
if (that.size())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return that.SetAllocator(AuUnsafeRaiiToShared(pHeap));
|
||||
}
|
||||
|
||||
if constexpr (__audetail::AuHasSetHeapSharedVoid_v<T>)
|
||||
{
|
||||
if (that.size())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
that.SetHeap(AuUnsafeRaiiToShared(pHeap));
|
||||
return true;
|
||||
}
|
||||
|
||||
if constexpr (__audetail::AuHasSetHeapSharedBool_v<T>)
|
||||
{
|
||||
if (that.size())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return that.SetHeap(AuUnsafeRaiiToShared(pHeap));
|
||||
}
|
||||
|
||||
if constexpr (__audetail::AuHasSetHeapSharedSharedVoid_v<T>)
|
||||
{
|
||||
if (that.size())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
that.SetHeapShared(AuUnsafeRaiiToShared(pHeap));
|
||||
return true;
|
||||
}
|
||||
|
||||
if constexpr (__audetail::AuHasSetHeapSharedSharedBool_v<T>)
|
||||
{
|
||||
if (that.size())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return that.SetHeapShared(AuUnsafeRaiiToShared(pHeap));
|
||||
}
|
||||
|
||||
if constexpr (__audetail::AuHasAllocatorType_v<T>)
|
||||
{
|
||||
if (that.size())
|
||||
{
|
||||
AUROXTL_COMMODITY_TRY
|
||||
{
|
||||
T copy { that, typename T::allocator_type { pHeap } };
|
||||
AuResetMember(that, AuMove(copy));
|
||||
}
|
||||
AUROXTL_COMMODITY_CATCH
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
AuResetMember(that, typename T::allocator_type { pHeap });
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if constexpr (__audetail::AuHasSetAllocatorRawVoid_v<T>)
|
||||
{
|
||||
that.SetAllocator(pHeap);
|
||||
return true;
|
||||
}
|
||||
|
||||
if constexpr (__audetail::AuHasSetAllocatorRawBool_v<T>)
|
||||
{
|
||||
return that.SetAllocator(pHeap);
|
||||
}
|
||||
|
||||
if constexpr (__audetail::AuHasSetHeapRawVoid_v<T>)
|
||||
{
|
||||
that.SetHeap(pHeap);
|
||||
return true;
|
||||
}
|
||||
|
||||
if constexpr (__audetail::AuHasSetHeapRawBool_v<T>)
|
||||
{
|
||||
return that.SetHeap(pHeap);
|
||||
}
|
||||
|
||||
if constexpr (__audetail::AuHasSetAllocatorSharedVoid_v<T>)
|
||||
{
|
||||
that.SetAllocator(AuUnsafeRaiiToShared(pHeap));
|
||||
return true;
|
||||
}
|
||||
|
||||
if constexpr (__audetail::AuHasSetAllocatorSharedBool_v<T>)
|
||||
{
|
||||
return that.SetAllocator(AuUnsafeRaiiToShared(pHeap));
|
||||
}
|
||||
|
||||
if constexpr (__audetail::AuHasSetHeapSharedVoid_v<T>)
|
||||
{
|
||||
that.SetHeap(AuUnsafeRaiiToShared(pHeap));
|
||||
return true;
|
||||
}
|
||||
|
||||
if constexpr (__audetail::AuHasSetHeapSharedBool_v<T>)
|
||||
{
|
||||
return that.SetHeap(AuUnsafeRaiiToShared(pHeap));
|
||||
}
|
||||
|
||||
if constexpr (__audetail::AuHasSetHeapSharedSharedVoid_v<T>)
|
||||
{
|
||||
that.SetHeapShared(AuUnsafeRaiiToShared(pHeap));
|
||||
return true;
|
||||
}
|
||||
|
||||
if constexpr (__audetail::AuHasSetHeapSharedSharedBool_v<T>)
|
||||
{
|
||||
return that.SetHeapShared(AuUnsafeRaiiToShared(pHeap));
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
template <typename T>
|
||||
static bool AuSetAllocator(T &that, const AuSPtr<Aurora::Memory::Heap> &pHeap)
|
||||
{
|
||||
if (!pHeap)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if constexpr (__audetail::AuHassize_v<T>)
|
||||
{
|
||||
if constexpr (__audetail::AuHasSetAllocatorSharedVoid_v<T>)
|
||||
{
|
||||
if (that.size())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
that.SetAllocator(pHeap);
|
||||
return true;
|
||||
}
|
||||
|
||||
if constexpr (__audetail::AuHasSetAllocatorSharedBool_v<T>)
|
||||
{
|
||||
if (that.size())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return that.SetAllocator(pHeap);
|
||||
}
|
||||
|
||||
if constexpr (__audetail::AuHasSetHeapSharedVoid_v<T>)
|
||||
{
|
||||
if (that.size())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
that.SetHeap(pHeap);
|
||||
return true;
|
||||
}
|
||||
|
||||
if constexpr (__audetail::AuHasSetHeapSharedBool_v<T>)
|
||||
{
|
||||
if (that.size())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return that.SetHeap(pHeap);
|
||||
}
|
||||
|
||||
if constexpr (__audetail::AuHasSetHeapSharedSharedVoid_v<T>)
|
||||
{
|
||||
if (that.size())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
that.SetHeapShared(pHeap);
|
||||
return true;
|
||||
}
|
||||
|
||||
if constexpr (__audetail::AuHasSetHeapSharedSharedBool_v<T>)
|
||||
{
|
||||
if (that.size())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return that.SetHeapShared(pHeap);
|
||||
}
|
||||
|
||||
if constexpr (__audetail::AuHasSetAllocatorRawVoid_v<T>)
|
||||
{
|
||||
if (that.size())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
that.SetAllocator(pHeap.get());
|
||||
return true;
|
||||
}
|
||||
|
||||
if constexpr (__audetail::AuHasSetAllocatorRawBool_v<T>)
|
||||
{
|
||||
if (that.size())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return that.SetAllocator(pHeap.get());
|
||||
}
|
||||
|
||||
if constexpr (__audetail::AuHasSetHeapRawVoid_v<T>)
|
||||
{
|
||||
if (that.size())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
that.SetHeap(pHeap.get());
|
||||
return true;
|
||||
}
|
||||
|
||||
if constexpr (__audetail::AuHasSetHeapRawBool_v<T>)
|
||||
{
|
||||
if (that.size())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return that.SetHeap(pHeap.get());
|
||||
}
|
||||
|
||||
if constexpr (__audetail::AuHasAllocatorType_v<T>)
|
||||
{
|
||||
if (that.size())
|
||||
{
|
||||
AUROXTL_COMMODITY_TRY
|
||||
{
|
||||
T copy { that, typename T::allocator_type { pHeap } };
|
||||
AuResetMember(that, AuMove(copy));
|
||||
}
|
||||
AUROXTL_COMMODITY_CATCH
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
AuResetMember(that, typename T::allocator_type { pHeap });
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if constexpr (__audetail::AuHasSetAllocatorSharedVoid_v<T>)
|
||||
{
|
||||
that.SetAllocator(pHeap);
|
||||
return true;
|
||||
}
|
||||
|
||||
if constexpr (__audetail::AuHasSetAllocatorSharedBool_v<T>)
|
||||
{
|
||||
return that.SetAllocator(pHeap);
|
||||
}
|
||||
|
||||
if constexpr (__audetail::AuHasSetHeapSharedVoid_v<T>)
|
||||
{
|
||||
that.SetHeap(pHeap);
|
||||
return true;
|
||||
}
|
||||
|
||||
if constexpr (__audetail::AuHasSetHeapSharedBool_v<T>)
|
||||
{
|
||||
return that.SetHeap(pHeap);
|
||||
}
|
||||
|
||||
if constexpr (__audetail::AuHasSetHeapSharedSharedVoid_v<T>)
|
||||
{
|
||||
that.SetHeapShared(pHeap);
|
||||
return true;
|
||||
}
|
||||
|
||||
if constexpr (__audetail::AuHasSetHeapSharedSharedBool_v<T>)
|
||||
{
|
||||
return that.SetHeapShared(pHeap);
|
||||
}
|
||||
|
||||
if constexpr (__audetail::AuHasSetAllocatorRawVoid_v<T>)
|
||||
{
|
||||
that.SetAllocator(pHeap.get());
|
||||
return true;
|
||||
}
|
||||
|
||||
if constexpr (__audetail::AuHasSetAllocatorRawBool_v<T>)
|
||||
{
|
||||
return that.SetAllocator(pHeap.get());
|
||||
}
|
||||
|
||||
if constexpr (__audetail::AuHasSetHeapRawVoid_v<T>)
|
||||
{
|
||||
that.SetHeap(pHeap.get());
|
||||
return true;
|
||||
}
|
||||
|
||||
if constexpr (__audetail::AuHasSetHeapRawBool_v<T>)
|
||||
{
|
||||
return that.SetHeap(pHeap.get());
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
38
Include/auROXTL/MemoryModel/auSizeOf.hpp
Normal file
38
Include/auROXTL/MemoryModel/auSizeOf.hpp
Normal file
@ -0,0 +1,38 @@
|
||||
/***
|
||||
Copyright (C) 2023-2024 Jamie Reece Wilson (a/k/a "Reece"). All rights reserved.
|
||||
|
||||
File: auSizeOf.hpp
|
||||
Date: 2023-02-04 - 2024-09-09
|
||||
Author: Reece
|
||||
***/
|
||||
#pragma once
|
||||
|
||||
template <typename T>
|
||||
constexpr AuUInt AuSizeOf()
|
||||
{
|
||||
return sizeof(T);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
constexpr AuUInt AuSizeOf(const T &)
|
||||
{
|
||||
return sizeof(T);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
constexpr AuUInt AuSizeOf(const T *)
|
||||
{
|
||||
return sizeof(T);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
constexpr AuUInt AuSizeOf(const AuSPtr<T>)
|
||||
{
|
||||
return sizeof(T);
|
||||
}
|
||||
|
||||
template <typename T, class Del_t>
|
||||
constexpr AuUInt AuSizeOf(const AuUPtr<T, Del_t> &)
|
||||
{
|
||||
return sizeof(T);
|
||||
}
|
@ -59,19 +59,10 @@ static auline void AuMemoryPanic(const char *msg)
|
||||
#endif
|
||||
}
|
||||
|
||||
template <class T, AuUInt Z>
|
||||
static constexpr AuUInt AuArraySize(const T(&array)[Z])
|
||||
{
|
||||
return Z;
|
||||
}
|
||||
#include "MemoryModel/auArraySize.hpp"
|
||||
#include "MemoryModel/auSizeOf.hpp"
|
||||
#include "MemoryModel/auOffsetOf.hpp"
|
||||
|
||||
template <typename T, typename C>
|
||||
static AuUInt AuOffsetOf(C T:: *offset)
|
||||
{
|
||||
return AuUInt(
|
||||
&(((const T *)(nullptr))->*offset)
|
||||
);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
static auto AuTryLockMemoryType(T weak) -> decltype(weak.lock())
|
||||
@ -91,30 +82,6 @@ static auto AuTryLockMemoryType(T weak) -> decltype(weak.lock())
|
||||
}
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
constexpr AuUInt AuSizeOf()
|
||||
{
|
||||
return sizeof(T);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
constexpr AuUInt AuSizeOf(const T &)
|
||||
{
|
||||
return sizeof(T);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
constexpr AuUInt AuSizeOf(const T *)
|
||||
{
|
||||
return sizeof(T);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
constexpr AuUInt AuSizeOf(const AuSPtr<T>)
|
||||
{
|
||||
return sizeof(T);
|
||||
}
|
||||
|
||||
template <class Z, typename T>
|
||||
static void auline AuSafeDelete(T *in)
|
||||
{
|
||||
@ -490,3 +457,5 @@ inline constexpr bool operator!=(const Aurora::Memory::BaseAuroraRuntimeAllocato
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
#include <auROXTL/MemoryModel/auSetAllocator.hpp>
|
@ -57,6 +57,7 @@ namespace __audetail
|
||||
constexpr inline bool AuHas ## name ## _v = AuHas ## name<T>::type::value;
|
||||
_AUROXTL_DETAIAL_HAS(has_value);
|
||||
_AUROXTL_DETAIAL_HAS(capacity)
|
||||
_AUROXTL_DETAIAL_HAS(size)
|
||||
_AUROXTL_DETAIAL_HAS(reserve)
|
||||
|
||||
template <class T>
|
||||
|
@ -76,6 +76,8 @@ namespace __audetail
|
||||
|
||||
#include <auROXTL/Objects/SOO.hpp>
|
||||
|
||||
#include <auROXTL/MemoryModel/auSetAllocator.ipp>
|
||||
|
||||
struct IAuNullDelegate
|
||||
{
|
||||
virtual void OnCall() = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user