diff options
author | Emanuele Torre <torreemanuele6@gmail.com> | 2020-08-01 07:13:50 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-08-01 10:44:42 +0200 |
commit | 5bf994d2d9fffa73f22f25f792e1482dc43a694e (patch) | |
tree | 3fa4800dbed124213b70789b7f0cc96891e6be41 /AK | |
parent | 75a4b1a27e97bbfb8bcd99ebbd3e42fab70a069a (diff) | |
download | serenity-5bf994d2d9fffa73f22f25f792e1482dc43a694e.zip |
AK: Use C++20 concepts to only allow Userspace wrappers of pointers
It was a bit odd that you could create a Userspace<int> and that
Userspace<int>::ptr() returned an int instead of an int*.
Let's use C++20 concepts to only allow creating Userspace objects with
pointer types. :^)
Diffstat (limited to 'AK')
-rw-r--r-- | AK/Userspace.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/AK/Userspace.h b/AK/Userspace.h index 8f02f6d72f..d499363de6 100644 --- a/AK/Userspace.h +++ b/AK/Userspace.h @@ -26,11 +26,15 @@ #pragma once +#include <AK/StdLibExtras.h> #include <AK/Types.h> namespace AK { template<typename T> +concept PointerTypeName = IsPointer<T>::value; + +template<PointerTypeName T> class Userspace { public: Userspace() { } |