![]() |
Zen C++ Libraries
Zero-dependency re-usable components for C++
|
Generic tools and utilities for using and defining allocators. More...
#include <concepts>#include <new>#include <utility>#include "zen/config.hpp"Go to the source code of this file.
Concepts | |
| concept | DynamicAllocator |
Typedefs | |
| using | destroy_fn = void (*)(void *) |
Functions | |
| template<typename R, DynamicAllocator Alloc, typename ... Ts> | |
| R * | construct (Alloc &allocator, Ts &&...args) |
Generic tools and utilities for using and defining allocators.
Unless writing a custom allocator, the most essential declaration in this header file is zen::construct. It allows you to construct any object inside the allocator of choice.
| using destroy_fn = void (*)(void *) |
The signature of a function that is called whenever an object inside an allocator is going to be destroyed.
The function accepts a single void* parameter that contains a reference to the memory of the object that is being destroyed.
| R * construct | ( | Alloc & | allocator, |
| Ts &&... | args ) |
Construct an object inside the memory provided by the given allocator.