#pragma once #include #include #include #include class HeapMemoryFixedSizePool { public: class MemorySegmentInfo { public: MemorySegmentInfo(void *data, size_t size); [[nodiscard]] void *data() const; [[nodiscard]] size_t size() const; private: void *mData; size_t mSize; }; HeapMemoryFixedSizePool(); HeapMemoryFixedSizePool(std::initializer_list segmentSizes); HeapMemoryFixedSizePool(std::span segmentSizes); // Delete the copy constructor and copy assignment operator HeapMemoryFixedSizePool(const HeapMemoryFixedSizePool &) = delete; HeapMemoryFixedSizePool &operator=(const HeapMemoryFixedSizePool &) = delete; HeapMemoryFixedSizePool(HeapMemoryFixedSizePool &&other) noexcept; HeapMemoryFixedSizePool &operator=(HeapMemoryFixedSizePool &&other) noexcept; [[nodiscard]] uint32_t numberOfSegments() const; explicit operator bool() const; MemorySegmentInfo operator[](int idx) const; private: std::unique_ptr mData{}; std::size_t mTotalSize{}; std::vector mSegmentInfos; };