Allocate and free raw blocks on Base's heap. More...
Classes | |
| struct | ObjectDeleter |
| Destroy the concrete object and return its block to Free. More... | |
Functions | |
| void * | Allocate (std::size_t bytes) |
Allocate bytes on Base's heap. | |
| void | Free (void *pointer) noexcept |
| Release a block obtained from Allocate. | |
| void | ThrowExpiredWeakPointer () |
| Throw ExpiredWeakPointerError. | |
| void | RethrowException () |
| Preserve an active StormByte exception or translate a foreign one. | |
Variables | |
| constexpr Size | Alignment {16} |
| Alignment guaranteed by Allocate, in bytes. | |
Allocate and free raw blocks on Base's heap.
Deleter for a caller-owned std::unique_ptr that still frees Base's block.
Public templates call Allocate and Free through matching declarations in the public headers. This header exists only for the translation unit that defines those functions. A failed allocation throws AllocationError and does not allocate the exception message.
Allocation stays in the installed heap header. This name exists so a moved Unique keeps its published deleter type.
| void * StormByte::Safe::Heap::Allocate | ( | std::size_t | bytes | ) |
Allocate bytes on Base's heap.
| bytes | Block size in octets. Zero is forwarded to operator new. |
| AllocationError | The allocator cannot satisfy the request. std::bad_alloc is not propagated. |
| Exception | A StormByte exception already in flight is rethrown unchanged. |
| OperationError | A foreign exception is translated. If that translation cannot allocate, AllocationError is thrown instead. |
|
noexcept |
Release a block obtained from Allocate.
| pointer | Block address, or a null pointer. A null pointer is ignored. |
| void StormByte::Safe::Heap::RethrowException | ( | ) |
Preserve an active StormByte exception or translate a foreign one.
| Exception | A StormByte exception already in flight is rethrown unchanged. |
| AllocationError | The active exception is std::bad_alloc, or translating it cannot allocate. |
| OperationError | The active exception is foreign. The body is what(), or a fixed unknown-exception text. |
| void StormByte::Safe::Heap::ThrowExpiredWeakPointer | ( | ) |
Throw ExpiredWeakPointerError.
| ExpiredWeakPointerError | Always. The body does not include the path. |