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

@ -732,12 +732,12 @@ namespace ams::sf::impl {
template<size_t Index, typename Interface>
SharedPointer<Interface> *GetOutObjectSharedPointer() {
static_assert(sizeof(SharedPointer<Interface>) == sizeof(SharedPointer<sf::IServiceObject>));
return static_cast<SharedPointer<Interface> *>(static_cast<void *>(&out_shared_pointers[Index]));
return static_cast<SharedPointer<Interface> *>(static_cast<void *>(GetPointer(out_shared_pointers[Index])));
}
template<size_t Index, typename Interface>
Out<SharedPointer<Interface>> GetOutObject() {
auto sp = new (GetOutObjectSharedPointer<Index, Interface>()) SharedPointer<Interface>;
auto sp = std::construct_at(GetOutObjectSharedPointer<Index, Interface>());
return Out<SharedPointer<Interface>>(sp, &this->out_object_ids[Index]);
}