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

AK: Rename create<T> => make_ref_counted<T>

And also try_create<T> => try_make_ref_counted<T>.

A global "create" was a bit much. The new name matches make<T> better,
which we've used for making single-owner objects since forever.
This commit is contained in:
Andreas Kling 2021-09-03 00:07:29 +02:00
parent 43a800a838
commit eaf88cc78a
17 changed files with 137 additions and 137 deletions

View file

@ -484,14 +484,14 @@ inline RefPtr<T> adopt_ref_if_nonnull(T* object)
}
template<typename T, class... Args>
requires(IsConstructible<T, Args...>) inline RefPtr<T> try_create(Args&&... args)
requires(IsConstructible<T, Args...>) inline RefPtr<T> try_make_ref_counted(Args&&... args)
{
return adopt_ref_if_nonnull(new (nothrow) T(forward<Args>(args)...));
}
// FIXME: Remove once P0960R3 is available in Clang.
template<typename T, class... Args>
inline RefPtr<T> try_create(Args&&... args)
inline RefPtr<T> try_make_ref_counted(Args&&... args)
{
return adopt_ref_if_nonnull(new (nothrow) T { forward<Args>(args)... });
}
@ -512,7 +512,7 @@ inline Kernel::KResultOr<NonnullRefPtr<T>> adopt_nonnull_ref_or_enomem(T* object
using AK::adopt_ref_if_nonnull;
using AK::RefPtr;
using AK::static_ptr_cast;
using AK::try_create;
using AK::try_make_ref_counted;
#ifdef KERNEL
using AK::adopt_nonnull_ref_or_enomem;