1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 06:17:35 +00:00

AK: Simplify MaybeOwned constructor

The previous version had a sequence of calls that are likely not
optimized out, while this version is strictly a sequence of static type
conversion which are always fully optimized out.
This commit is contained in:
kleines Filmröllchen 2023-05-25 00:13:58 +02:00 committed by Jelle Raaijmakers
parent 7a6b1f179b
commit 80a228383b

View file

@ -18,7 +18,7 @@ class MaybeOwned {
public: public:
template<DerivedFrom<T> U> template<DerivedFrom<T> U>
MaybeOwned(NonnullOwnPtr<U> handle) MaybeOwned(NonnullOwnPtr<U> handle)
: m_handle(adopt_own<T>(*handle.leak_ptr())) : m_handle(static_cast<NonnullOwnPtr<T>&&>(move(handle)))
{ {
} }