mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-06-09 09:34:57 +09:00
AK: Move try_make() to NonnullOwnPtr.h
This commit is contained in:
parent
6bc6085219
commit
3c842d9d76
Notes:
sideshowbarker
2024-07-17 00:31:28 +09:00
Author: https://github.com/nico
Commit: 3c842d9d76
Pull-request: https://github.com/SerenityOS/serenity/pull/17431
Reviewed-by: https://github.com/trflynn89 ✅
2 changed files with 15 additions and 15 deletions
15
AK/OwnPtr.h
15
AK/OwnPtr.h
|
@ -192,20 +192,6 @@ inline OwnPtr<T> adopt_own_if_nonnull(T* object)
|
|||
return {};
|
||||
}
|
||||
|
||||
template<typename T, class... Args>
|
||||
requires(IsConstructible<T, Args...>) inline ErrorOr<NonnullOwnPtr<T>> try_make(Args&&... args)
|
||||
{
|
||||
return adopt_nonnull_own_or_enomem(new (nothrow) T(forward<Args>(args)...));
|
||||
}
|
||||
|
||||
// FIXME: Remove once P0960R3 is available in Clang.
|
||||
template<typename T, class... Args>
|
||||
inline ErrorOr<NonnullOwnPtr<T>> try_make(Args&&... args)
|
||||
|
||||
{
|
||||
return adopt_nonnull_own_or_enomem(new (nothrow) T { forward<Args>(args)... });
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
struct Traits<OwnPtr<T>> : public GenericTraits<OwnPtr<T>> {
|
||||
using PeekType = T*;
|
||||
|
@ -219,5 +205,4 @@ struct Traits<OwnPtr<T>> : public GenericTraits<OwnPtr<T>> {
|
|||
#if USING_AK_GLOBALLY
|
||||
using AK::adopt_own_if_nonnull;
|
||||
using AK::OwnPtr;
|
||||
using AK::try_make;
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue