AK: Use AK_MAKE_DEFAULT_MOVABLE to avoid mistakes in default impls

This commit is contained in:
Ben Wiederhake 2023-06-16 16:03:16 +02:00 committed by Sam Atkins
parent 3d3dfc8da8
commit 041f5e931d
3 changed files with 4 additions and 16 deletions

View file

@ -21,6 +21,7 @@ concept SeekableStreamLike = IsBaseOf<SeekableStream, T>;
template<typename T>
class BufferedHelper {
AK_MAKE_NONCOPYABLE(BufferedHelper);
AK_MAKE_DEFAULT_MOVABLE(BufferedHelper);
public:
template<StreamLike U>
@ -30,19 +31,6 @@ public:
{
}
BufferedHelper(BufferedHelper&& other)
: m_stream(move(other.m_stream))
, m_buffer(move(other.m_buffer))
{
}
BufferedHelper& operator=(BufferedHelper&& other)
{
m_stream = move(other.m_stream);
m_buffer = move(other.m_buffer);
return *this;
}
template<template<typename> typename BufferedType>
static ErrorOr<NonnullOwnPtr<BufferedType<T>>> create_buffered(NonnullOwnPtr<T> stream, size_t buffer_size)
{

View file

@ -15,14 +15,12 @@ namespace AK {
class CircularBuffer {
AK_MAKE_NONCOPYABLE(CircularBuffer);
AK_MAKE_DEFAULT_MOVABLE(CircularBuffer);
public:
static ErrorOr<CircularBuffer> create_empty(size_t size);
static ErrorOr<CircularBuffer> create_initialized(ByteBuffer);
CircularBuffer(CircularBuffer&& other) = default;
CircularBuffer& operator=(CircularBuffer&& other) = default;
~CircularBuffer() = default;
size_t write(ReadonlyBytes bytes);

View file

@ -36,6 +36,8 @@ public:
}
SourceGenerator(SourceGenerator&&) = default;
// Move-assign is undefinable due to 'StringBuilder& m_builder;'
SourceGenerator& operator=(SourceGenerator&&) = delete;
ErrorOr<SourceGenerator> fork()
{