瀏覽代碼

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.
kleines Filmröllchen 2 年之前
父節點
當前提交
80a228383b
共有 1 個文件被更改,包括 1 次插入1 次删除
  1. 1 1
      AK/MaybeOwned.h

+ 1 - 1
AK/MaybeOwned.h

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