[*] 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 > template <class U, class... Args >
void construct(U *p, Args&&... 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 > template <class U, class... Args >
void construct_at(U *p, Args&&... 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) const size_t count)
{ {
this->deallocate_bytes((void *)pType, 0, 0); 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) if (!count)
{ {
@ -360,9 +354,6 @@ namespace Aurora::Memory
U *new_object(CtorArgs&&... args) U *new_object(CtorArgs&&... args)
{ {
U *p = this->allocate_object<U>(); U *p = this->allocate_object<U>();
if constexpr (AuIsClass_v<U> &&
!AuIsTriviallyConstructible_v<U, CtorArgs>)
{
try try
{ {
this->construct(p, AuForward<CtorArgs>(args)...); this->construct(p, AuForward<CtorArgs>(args)...);
@ -372,7 +363,6 @@ namespace Aurora::Memory
this->deallocate_object(p); this->deallocate_object(p);
throw; throw;
} }
}
return p; return p;
} }
@ -392,6 +382,12 @@ namespace Aurora::Memory
{ {
return true; return true;
} }
template <class T>
inline bool operator==(const BaseAuroraRuntimeAllocator<T> &op)
{
return true;
}
}; };