1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 05:27:46 +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

@ -333,14 +333,14 @@ inline void swap(NonnullRefPtr<T>& a, NonnullRefPtr<U>& b)
}
template<typename T, class... Args>
requires(IsConstructible<T, Args...>) inline NonnullRefPtr<T> create(Args&&... args)
requires(IsConstructible<T, Args...>) inline NonnullRefPtr<T> make_ref_counted(Args&&... args)
{
return NonnullRefPtr<T>(NonnullRefPtr<T>::Adopt, *new T(forward<Args>(args)...));
}
// FIXME: Remove once P0960R3 is available in Clang.
template<typename T, class... Args>
inline NonnullRefPtr<T> create(Args&&... args)
inline NonnullRefPtr<T> make_ref_counted(Args&&... args)
{
return NonnullRefPtr<T>(NonnullRefPtr<T>::Adopt, *new T { forward<Args>(args)... });
}
@ -355,5 +355,5 @@ struct Traits<NonnullRefPtr<T>> : public GenericTraits<NonnullRefPtr<T>> {
};
using AK::adopt_ref;
using AK::create;
using AK::make_ref_counted;
using AK::NonnullRefPtr;