[*] fix
This commit is contained in:
parent
b47cf9f181
commit
76b5466e87
@ -152,19 +152,13 @@ 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)...);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void deallocate(const T *pType,
|
void deallocate(const T *pType,
|
||||||
@ -199,18 +193,14 @@ 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> &&
|
try
|
||||||
!AuIsTriviallyConstructible_v<U, CtorArgs>)
|
|
||||||
{
|
{
|
||||||
try
|
this->construct(p, AuForward<CtorArgs>(args)...);
|
||||||
{
|
}
|
||||||
this->construct(p, AuForward<CtorArgs>(args)...);
|
catch (...)
|
||||||
}
|
{
|
||||||
catch (...)
|
this->deallocate_object(p);
|
||||||
{
|
throw;
|
||||||
this->deallocate_object(p);
|
|
||||||
throw;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user