mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-12-28 21:54:40 +03: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
@ -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 New Issue
Block a user