WiiUPluginLoaderBackend/source/utils/HeapMemoryFixedSize.h

29 lines
713 B
C
Raw Permalink Normal View History

#pragma once
2024-11-27 20:44:36 +01:00
#include <cstdint>
#include <memory>
class HeapMemoryFixedSize {
public:
2024-11-27 20:44:36 +01:00
HeapMemoryFixedSize();
2024-11-27 20:44:36 +01:00
explicit HeapMemoryFixedSize(std::size_t size);
// Delete the copy constructor and copy assignment operator
HeapMemoryFixedSize(const HeapMemoryFixedSize &) = delete;
HeapMemoryFixedSize &operator=(const HeapMemoryFixedSize &) = delete;
2024-11-27 20:44:36 +01:00
HeapMemoryFixedSize(HeapMemoryFixedSize &&other) noexcept;
HeapMemoryFixedSize &operator=(HeapMemoryFixedSize &&other) noexcept;
explicit operator bool() const;
[[nodiscard]] const void *data() const;
[[nodiscard]] std::size_t size() const;
private:
std::unique_ptr<uint8_t[]> mData{};
std::size_t mSize{};
};