AK: Hide the infallible make<T> factory function from the Kernel

This function has no users, nor should it ever be used in the kernel,
as all allocation failures in the Kernel should be explicitly checked.
This commit is contained in:
Idan Horowitz 2022-02-03 16:47:43 +02:00 committed by Andreas Kling
parent 7933a9b6c8
commit ba0a2a3e2f
Notes: sideshowbarker 2024-07-17 19:49:33 +09:00

View File

@ -159,8 +159,6 @@ inline NonnullOwnPtr<T> adopt_own(T& object)
return NonnullOwnPtr<T>(NonnullOwnPtr<T>::Adopt, object);
}
#endif
template<class T, class... Args>
requires(IsConstructible<T, Args...>) inline NonnullOwnPtr<T> make(Args&&... args)
{
@ -174,6 +172,8 @@ inline NonnullOwnPtr<T> make(Args&&... args)
return NonnullOwnPtr<T>(NonnullOwnPtr<T>::Adopt, *new T { forward<Args>(args)... });
}
#endif
template<typename T>
struct Traits<NonnullOwnPtr<T>> : public GenericTraits<NonnullOwnPtr<T>> {
using PeekType = T*;
@ -200,6 +200,6 @@ struct Formatter<NonnullOwnPtr<T>> : Formatter<const T*> {
#if !defined(KERNEL)
using AK::adopt_own;
#endif
using AK::make;
#endif
using AK::NonnullOwnPtr;