[*] pmr equality?

This commit is contained in:
Reece Wilson 2024-04-21 06:04:37 +01:00
parent 0d01c3050d
commit 9e527bbe3c

View File

@ -313,28 +313,22 @@ namespace Aurora::Memory
template <class U, class... Args >
void construct(U *p, Args&&... args)
{
if constexpr (AuIsClass_v<U>)
{
new ((void *)p) U(AuForward<Args &&>(args)...);
}
new ((void *)p) U(AuForward<Args>(args)...);
}
template <class U, class... Args >
void construct_at(U *p, Args&&... args)
{
if constexpr (AuIsClass_v<U>)
{
new ((void *)p) U(AuForward<Args &&>(args)...);
}
new ((void *)p) U(AuForward<Args>(args)...);
}
constexpr void deallocate(const T *pType,
void deallocate(const T *pType,
const size_t count)
{
this->deallocate_bytes((void *)pType, 0, 0);
}
constexpr AU_ALLOC T *allocate(const size_t count)
AU_ALLOC T *allocate(const size_t count)
{
if (!count)
{
@ -360,18 +354,14 @@ namespace Aurora::Memory
U *new_object(CtorArgs&&... args)
{
U *p = this->allocate_object<U>();
if constexpr (AuIsClass_v<U> &&
!AuIsTriviallyConstructible_v<U, CtorArgs>)
try
{
try
{
this->construct(p, AuForward<CtorArgs>(args)...);
}
catch (...)
{
this->deallocate_object(p);
throw;
}
this->construct(p, AuForward<CtorArgs>(args)...);
}
catch (...)
{
this->deallocate_object(p);
throw;
}
return p;
}
@ -392,6 +382,12 @@ namespace Aurora::Memory
{
return true;
}
template <class T>
inline bool operator==(const BaseAuroraRuntimeAllocator<T> &op)
{
return true;
}
};