Sane C++ Libraries
C++ Platform Abstraction Libraries
HeapBuffer.h
1// Copyright (c) Stefano Cristiano
2// SPDX-License-Identifier: MIT
3#pragma once
4#include "../Foundation/Span.h"
5namespace SC
6{
7struct HeapBuffer;
8}
11
14{
15 Span<char> data;
16
17 HeapBuffer();
19
20 HeapBuffer(HeapBuffer&& other);
21 HeapBuffer(const HeapBuffer& other) = delete;
22
23 HeapBuffer& operator=(const HeapBuffer& other) = delete;
24 HeapBuffer& operator=(HeapBuffer&& other);
25
27 [[nodiscard]] bool allocate(size_t numBytes);
28
30 void release();
31};
32
A move-only owned buffer of bytes.
Definition: HeapBuffer.h:14
void release()
Releases any previously allocated memory.
bool allocate(size_t numBytes)
Allocates numBytes releasing previously allocated memory.
View over a contiguous sequence of items (pointer + size in elements).
Definition: Span.h:20