mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 15:40:19 +00:00
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. :^)
This commit is contained in:
parent
75a4b1a27e
commit
5bf994d2d9
Notes:
sideshowbarker
2024-07-19 04:24:50 +09:00
Author: https://github.com/emanuele6 Commit: https://github.com/SerenityOS/serenity/commit/5bf994d2d9f Pull-request: https://github.com/SerenityOS/serenity/pull/2937 Reviewed-by: https://github.com/awesomekling
1 changed files with 4 additions and 0 deletions
|
@ -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() { }
|
||||
|
|
Loading…
Reference in a new issue