mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-06-09 17:44:56 +09: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:
parent
4dd104607d
commit
3c1ef744f6
Notes:
sideshowbarker
2024-07-19 01:27:35 +09:00
Author: https://github.com/tomuta
Commit: 3c1ef744f6
Pull-request: https://github.com/SerenityOS/serenity/pull/4012
5 changed files with 131 additions and 71 deletions
|
@ -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>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue