1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 01:27:34 +00:00

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. :^)
This commit is contained in:
AnotherTest 2021-04-10 18:29:06 +04:30 committed by Andreas Kling
parent d8d16dea95
commit a6e4482080
41 changed files with 650 additions and 662 deletions

View file

@ -148,13 +148,13 @@ InputStream& operator>>(InputStream& stream, Optional<T>& value)
}
template<typename Integral>
InputStream& operator>>(InputStream& stream, Integral& value) requires IsIntegral<Integral>::value
InputStream& operator>>(InputStream& stream, Integral& value) requires IsIntegral<Integral>
{
stream.read_or_error({ &value, sizeof(value) });
return stream;
}
template<typename Integral>
OutputStream& operator<<(OutputStream& stream, Integral value) requires IsIntegral<Integral>::value
OutputStream& operator<<(OutputStream& stream, Integral value) requires IsIntegral<Integral>
{
stream.write_or_error({ &value, sizeof(value) });
return stream;
@ -163,13 +163,13 @@ OutputStream& operator<<(OutputStream& stream, Integral value) requires IsIntegr
#ifndef KERNEL
template<typename FloatingPoint>
InputStream& operator>>(InputStream& stream, FloatingPoint& value) requires IsFloatingPoint<FloatingPoint>::value
InputStream& operator>>(InputStream& stream, FloatingPoint& value) requires IsFloatingPoint<FloatingPoint>
{
stream.read_or_error({ &value, sizeof(value) });
return stream;
}
template<typename FloatingPoint>
OutputStream& operator<<(OutputStream& stream, FloatingPoint value) requires IsFloatingPoint<FloatingPoint>::value
OutputStream& operator<<(OutputStream& stream, FloatingPoint value) requires IsFloatingPoint<FloatingPoint>
{
stream.write_or_error({ &value, sizeof(value) });
return stream;