ams: prefer construct_at/destroy_at over placement new/explicit destructor

This commit is contained in:
Michael Scire
2021-03-21 20:30:40 -07:00
parent aff0da9427
commit d84dcb653d
49 changed files with 217 additions and 171 deletions

View File

@@ -38,7 +38,7 @@ namespace ams::i2c::driver::board::nintendo::nx::impl {
T *obj = std::addressof(*it);
it = this->list.erase(it);
obj->~T();
std::destroy_at(obj);
this->memory_resource->Deallocate(obj, sizeof(T));
}
}
@@ -52,7 +52,7 @@ namespace ams::i2c::driver::board::nintendo::nx::impl {
AMS_ABORT_UNLESS(storage != nullptr);
/* Construct the object. */
T *t = new (static_cast<T *>(storage)) T(std::forward<Args>(args)...);
T *t = std::construct_at(static_cast<T *>(storage), std::forward<Args>(args)...);
/* Link the object into our list. */
this->list.push_back(*t);