#include "HeapMemoryFixedSize.h" #include "utils.h" HeapMemoryFixedSize::HeapMemoryFixedSize() = default; HeapMemoryFixedSize::HeapMemoryFixedSize(std::size_t size) : mData(make_unique_nothrow(size)), mSize(mData ? size : 0) {} HeapMemoryFixedSize::HeapMemoryFixedSize(HeapMemoryFixedSize &&other) noexcept : mData(std::move(other.mData)), mSize(other.mSize) { other.mSize = 0; } HeapMemoryFixedSize &HeapMemoryFixedSize::operator=(HeapMemoryFixedSize &&other) noexcept { if (this != &other) { mData = std::move(other.mData); mSize = other.mSize; other.mSize = 0; } return *this; } HeapMemoryFixedSize::operator bool() const { return mData != nullptr; } [[nodiscard]] const void *HeapMemoryFixedSize::data() const { return mData.get(); } [[nodiscard]] std::size_t HeapMemoryFixedSize::size() const { return mSize; }