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

AK: Add RefPtrTraits to allow implementing custom null pointers

This adds the ability to implement custom null states that allow
storing state in null pointers.
This commit is contained in:
Tom 2020-09-23 10:17:43 -06:00 committed by Andreas Kling
parent 4dd104607d
commit 3c1ef744f6
5 changed files with 131 additions and 71 deletions

View file

@ -35,7 +35,7 @@
namespace AK {
template<typename T>
template<typename T, typename PtrTraits>
class RefPtr;
template<typename T>
class NonnullRefPtr;
@ -85,14 +85,14 @@ public:
template<typename U>
NonnullOwnPtr& operator=(const NonnullOwnPtr<U>&) = delete;
template<typename U>
NonnullOwnPtr(const RefPtr<U>&) = delete;
template<typename U, typename PtrTraits = RefPtrTraits<U>>
NonnullOwnPtr(const RefPtr<U, PtrTraits>&) = delete;
template<typename U>
NonnullOwnPtr(const NonnullRefPtr<U>&) = delete;
template<typename U>
NonnullOwnPtr(const WeakPtr<U>&) = delete;
template<typename U>
NonnullOwnPtr& operator=(const RefPtr<U>&) = delete;
template<typename U, typename PtrTraits = RefPtrTraits<U>>
NonnullOwnPtr& operator=(const RefPtr<U, PtrTraits>&) = delete;
template<typename U>
NonnullOwnPtr& operator=(const NonnullRefPtr<U>&) = delete;
template<typename U>