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

Everywhere: Switch from EnableIf to requires

C++20 provides the `requires` clause which simplifies the ability to
limit overload resolution. Prefer it over `EnableIf`

With all uses of `EnableIf` being removed, also remove the
implementation so future devs are not tempted.
This commit is contained in:
Lenny Maiorani 2022-03-17 11:29:46 -06:00 committed by Brian Gianforcaro
parent 8f7219c6fa
commit 2844f7c333
9 changed files with 63 additions and 73 deletions

View file

@ -17,11 +17,11 @@ namespace AK {
// FIXME: Implement Buffered<T> for DuplexStream.
template<typename StreamType, size_t Size = 4096, typename = void>
template<typename StreamType, size_t Size = 4096>
class Buffered;
template<typename StreamType, size_t Size>
class Buffered<StreamType, Size, typename EnableIf<IsBaseOf<InputStream, StreamType>>::Type> final : public InputStream {
requires(IsBaseOf<InputStream, StreamType>) class Buffered<StreamType, Size> final : public InputStream {
AK_MAKE_NONCOPYABLE(Buffered);
public:
@ -119,7 +119,7 @@ private:
};
template<typename StreamType, size_t Size>
class Buffered<StreamType, Size, typename EnableIf<IsBaseOf<OutputStream, StreamType>>::Type> final : public OutputStream {
requires(IsBaseOf<OutputStream, StreamType>) class Buffered<StreamType, Size> : public OutputStream {
AK_MAKE_NONCOPYABLE(Buffered);
public:
@ -192,7 +192,6 @@ private:
u8 m_buffer[Size];
size_t m_buffered { 0 };
};
}
using AK::Buffered;