summaryrefslogtreecommitdiff
path: root/Kernel/StdLib.h
diff options
context:
space:
mode:
authorAnotherTest <ali.mpfard@gmail.com>2021-04-10 18:29:06 +0430
committerAndreas Kling <kling@serenityos.org>2021-04-10 21:01:31 +0200
commita6e448208052c2d03fca53a4061a367b33167d37 (patch)
tree0d6f84d1257e2af57d28a3102d0622fcf716782b /Kernel/StdLib.h
parentd8d16dea957f15f07ebb08d1578e21d97fc163bc (diff)
downloadserenity-a6e448208052c2d03fca53a4061a367b33167d37.zip
AK+Everywhere: Make StdLibExtras templates less wrapper-y
This commit makes the user-facing StdLibExtras templates and utilities arguably more nice-looking by removing the need to reach into the wrapper structs generated by them to get the value/type needed. The C++ standard library had to invent `_v` and `_t` variants (likely because of backwards compat), but we don't need to cater to any codebase except our own, so might as well have good things for free. :^)
Diffstat (limited to 'Kernel/StdLib.h')
-rw-r--r--Kernel/StdLib.h22
1 files changed, 11 insertions, 11 deletions
diff --git a/Kernel/StdLib.h b/Kernel/StdLib.h
index c00447b8b1..d11ab36ea4 100644
--- a/Kernel/StdLib.h
+++ b/Kernel/StdLib.h
@@ -77,28 +77,28 @@ const void* memmem(const void* haystack, size_t, const void* needle, size_t);
template<typename T>
[[nodiscard]] inline bool copy_from_user(T* dest, const T* src)
{
- static_assert(is_trivially_copyable<T>());
+ static_assert(IsTriviallyCopyable<T>);
return copy_from_user(dest, src, sizeof(T));
}
template<typename T>
[[nodiscard]] inline bool copy_to_user(T* dest, const T* src)
{
- static_assert(is_trivially_copyable<T>());
+ static_assert(IsTriviallyCopyable<T>);
return copy_to_user(dest, src, sizeof(T));
}
template<typename T>
[[nodiscard]] inline bool copy_from_user(T* dest, Userspace<const T*> src)
{
- static_assert(is_trivially_copyable<T>());
+ static_assert(IsTriviallyCopyable<T>);
return copy_from_user(dest, src.unsafe_userspace_ptr(), sizeof(T));
}
template<typename T>
[[nodiscard]] inline bool copy_from_user(T* dest, Userspace<T*> src)
{
- static_assert(is_trivially_copyable<T>());
+ static_assert(IsTriviallyCopyable<T>);
return copy_from_user(dest, src.unsafe_userspace_ptr(), sizeof(T));
}
@@ -125,28 +125,28 @@ DEPRECATE_COPY_FROM_USER_TYPE(timeval, copy_time_from_user)
template<typename T>
[[nodiscard]] inline bool copy_to_user(Userspace<T*> dest, const T* src)
{
- static_assert(is_trivially_copyable<T>());
+ static_assert(IsTriviallyCopyable<T>);
return copy_to_user(dest.unsafe_userspace_ptr(), src, sizeof(T));
}
template<typename T>
[[nodiscard]] inline bool copy_to_user(Userspace<T*> dest, const void* src, size_t size)
{
- static_assert(is_trivially_copyable<T>());
+ static_assert(IsTriviallyCopyable<T>);
return copy_to_user(dest.unsafe_userspace_ptr(), src, size);
}
template<typename T>
[[nodiscard]] inline bool copy_from_user(void* dest, Userspace<const T*> src, size_t size)
{
- static_assert(is_trivially_copyable<T>());
+ static_assert(IsTriviallyCopyable<T>);
return copy_from_user(dest, src.unsafe_userspace_ptr(), size);
}
template<typename T>
[[nodiscard]] inline bool copy_n_from_user(T* dest, const T* src, size_t count)
{
- static_assert(is_trivially_copyable<T>());
+ static_assert(IsTriviallyCopyable<T>);
Checked size = sizeof(T);
size *= count;
if (size.has_overflow())
@@ -157,7 +157,7 @@ template<typename T>
template<typename T>
[[nodiscard]] inline bool copy_n_to_user(T* dest, const T* src, size_t count)
{
- static_assert(is_trivially_copyable<T>());
+ static_assert(IsTriviallyCopyable<T>);
Checked size = sizeof(T);
size *= count;
if (size.has_overflow())
@@ -168,7 +168,7 @@ template<typename T>
template<typename T>
[[nodiscard]] inline bool copy_n_from_user(T* dest, Userspace<const T*> src, size_t count)
{
- static_assert(is_trivially_copyable<T>());
+ static_assert(IsTriviallyCopyable<T>);
Checked size = sizeof(T);
size *= count;
if (size.has_overflow())
@@ -179,7 +179,7 @@ template<typename T>
template<typename T>
[[nodiscard]] inline bool copy_n_to_user(Userspace<T*> dest, const T* src, size_t count)
{
- static_assert(is_trivially_copyable<T>());
+ static_assert(IsTriviallyCopyable<T>);
Checked size = sizeof(T);
size *= count;
if (size.has_overflow())