mirror of
https://github.com/Atmosphere-NX/Atmosphere.git
synced 2025-05-27 21:24:11 -04:00
ams: prefer construct_at/destroy_at over placement new/explicit destructor
This commit is contained in:
parent
aff0da9427
commit
d84dcb653d
49 changed files with 217 additions and 171 deletions
|
@ -113,7 +113,7 @@ namespace ams::kern {
|
|||
|
||||
if (AMS_LIKELY(allocated != nullptr)) {
|
||||
/* Construct the object. */
|
||||
new (allocated) T();
|
||||
std::construct_at(allocated);
|
||||
|
||||
/* Update our tracking. */
|
||||
size_t used = m_used.fetch_add(1) + 1;
|
||||
|
|
|
@ -216,7 +216,7 @@ namespace ams::kern {
|
|||
T *Allocate() {
|
||||
T *obj = reinterpret_cast<T *>(this->AllocateImpl());
|
||||
if (AMS_LIKELY(obj != nullptr)) {
|
||||
new (obj) T();
|
||||
std::construct_at(obj);
|
||||
}
|
||||
return obj;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue