|
nngn
|
Generic implementation of a malloc(3)-style allocator with headers.
More...
#include <tagging.h>


Classes | |
| struct | rebind |
Public Types | |
| using | block_type = typename D::block_type |
| using | value_type = typename D::value_type |
| using | pointer = value_type* |
| using | allocator |
Public Member Functions | |
| tagging_allocator (void)=default | |
| tagging_allocator (const tagging_allocator &rhs) | |
| tagging_allocator & | operator= (const tagging_allocator &rhs) |
| template<tagging_descriptor D1, typename A1 > | |
| tagging_allocator (const tagging_allocator< D1, A1 > &rhs) | |
| tagging_allocator (const allocator &a) | |
| tagging_allocator (tagging_allocator &&) noexcept=default | |
| tagging_allocator & | operator= (tagging_allocator &&) noexcept=default |
| ~tagging_allocator (void)=default | |
| pointer | allocate (std::size_t n) noexcept |
Allocates n objects (n.b.: only one header is added). | |
| template<typename I > requires (detail::has_typed_alloc<allocator, I>) | |
| pointer | allocate (std::size_t n, I i) noexcept |
| Typed allocation (see nngn::tracking_allocator). | |
| pointer | reallocate (pointer p, std::size_t n) noexcept |
| void | deallocate (pointer p, std::size_t n) noexcept |
| const allocator & | get_allocator (void) const |
| template<typename I > | |
| auto | allocate (std::size_t n, I i) noexcept -> pointer requires(detail::has_typed_alloc< allocator, I >) |
Static Private Member Functions | |
| static pointer | to_ptr (char *p) |
| static char * | raw_from_ptr (pointer p) |
| static auto | alloc_size (std::size_t n) |
Private Attributes | |
| allocator | alloc = {} |
Generic implementation of a malloc(3)-style allocator with headers.
Objects are allocated using T::block_type (e.g. nngn::alloc_block), meaning a header is added to each allocation. This tagging is transparent: after template instantiation, the interface deals only with T::block_type::value_type objects.
The following are conditionally supported based on whether they are supported in the upstream allocator A:
| using nngn::tagging_allocator< D, A >::allocator |
| using nngn::tagging_allocator< D, A >::block_type = typename D::block_type |
| using nngn::tagging_allocator< D, A >::pointer = value_type* |
| using nngn::tagging_allocator< D, A >::value_type = typename D::value_type |
|
default |
|
inline |
| nngn::tagging_allocator< D, A >::tagging_allocator | ( | const tagging_allocator< D1, A1 > & | rhs | ) |
|
inlineexplicit |
|
defaultnoexcept |
|
default |
|
inlinestaticprivate |
|
noexcept |
Allocates n objects (n.b.: only one header is added).

|
noexcept |
Typed allocation (see nngn::tracking_allocator).
|
noexcept |

|
noexcept |
|
inline |
| auto nngn::tagging_allocator< D, A >::operator= | ( | const tagging_allocator< D, A > & | rhs | ) |
|
defaultnoexcept |
|
staticprivate |

|
noexcept |
|
staticprivate |

|
private |