memory
Typedefs | Classes | Functions
memory_arena.hpp File Reference

Detailed Description

Class foonathan::memory::memory_arena and related functionality regarding BlockAllocators.

Typedefs

template<class RawAlloc >
using default_block_wrapper = growing_block_allocator< RawAlloc >
 
template<class BlockOrRawAllocator , template< typename... > class BlockAllocator = detail::default_block_wrapper>
using make_block_allocator_t = FOONATHAN_IMPL_DEFINED(typename std::conditional< is_block_allocator< BlockOrRawAllocator >::value, BlockOrRawAllocator, BlockAllocator< BlockOrRawAllocator > >::type)
 Takes either a BlockAllocator or a RawAllocator. More...
 

Classes

struct  memory_block
 A memory block. More...
 
struct  is_block_allocator< T >
 Traits that check whether a type models concept BlockAllocator. More...
 
class  memory_arena< BlockAllocator, Cached >
 A memory arena that manages huge memory blocks for a higher-level allocator. More...
 
class  growing_block_allocator< RawAllocator, Num, Den >
 A BlockAllocator that uses a given RawAllocator for allocating the blocks. More...
 
class  fixed_block_allocator< RawAllocator >
 A BlockAllocator that allows only one block allocation. More...
 

Variables

constexpr bool cached_arena
 
constexpr bool uncached_arena
 
constexpr bool cached_arena
 
constexpr bool uncached_arena
 

Functions

template<class BlockAllocator >
std::true_type is_block_allocator_impl (int, FOONATHAN_SFINAE(std::declval< memory_block & >()=std::declval< BlockAllocator & >().allocate_block()), FOONATHAN_SFINAE(std::declval< std::size_t & >()=std::declval< BlockAllocator & >().next_block_size()), FOONATHAN_SFINAE(std::declval< BlockAllocator >().deallocate_block(memory_block{})))
 
template<typename T >
std::false_type is_block_allocator_impl (short)
 
template<template< class... > class Wrapper, class BlockAllocator , typename... Args>
BlockAllocator make_block_allocator (std::true_type, std::size_t block_size, Args &&... args)
 
template<template< class... > class Wrapper, class RawAlloc >
auto make_block_allocator (std::false_type, std::size_t block_size, RawAlloc alloc=RawAlloc()) -> Wrapper< RawAlloc >
 
template<class BlockOrRawAllocator , typename... Args>
make_block_allocator_t< BlockOrRawAllocator > make_block_allocator (std::size_t block_size, Args &&... args)
 
template<template< class... > class BlockAllocator, class BlockOrRawAllocator , typename... Args>
make_block_allocator_t< BlockOrRawAllocator, BlockAllocator > make_block_allocator (std::size_t block_size, Args &&... args)
 
constexpr std::size_t operator""_KiB (unsigned long long value) noexcept
 Syntax sugar to express sizes with unit prefixes. More...
 
constexpr std::size_t operator""_KB (unsigned long long value) noexcept
 Syntax sugar to express sizes with unit prefixes. More...
 
constexpr std::size_t operator""_MiB (unsigned long long value) noexcept
 Syntax sugar to express sizes with unit prefixes. More...
 
constexpr std::size_t operator""_MB (unsigned long long value) noexcept
 Syntax sugar to express sizes with unit prefixes. More...
 
constexpr std::size_t operator""_GiB (unsigned long long value) noexcept
 Syntax sugar to express sizes with unit prefixes. More...
 
constexpr std::size_t operator""_GB (unsigned long long value) noexcept
 Syntax sugar to express sizes with unit prefixes. More...
 
template<class BlockOrRawAllocator , typename... Args>
make_block_allocator_t< BlockOrRawAllocator > make_block_allocator (std::size_t block_size, Args &&... args)
 
template<template< class... > class BlockAllocator, class BlockOrRawAllocator , typename... Args>
make_block_allocator_t< BlockOrRawAllocator, BlockAllocator > make_block_allocator (std::size_t block_size, Args &&... args)
 
constexpr std::size_t operator""_KiB (unsigned long long value) noexcept
 Syntax sugar to express sizes with unit prefixes. More...
 
constexpr std::size_t operator""_KB (unsigned long long value) noexcept
 Syntax sugar to express sizes with unit prefixes. More...
 
constexpr std::size_t operator""_MiB (unsigned long long value) noexcept
 Syntax sugar to express sizes with unit prefixes. More...
 
constexpr std::size_t operator""_MB (unsigned long long value) noexcept
 Syntax sugar to express sizes with unit prefixes. More...
 
constexpr std::size_t operator""_GiB (unsigned long long value) noexcept
 Syntax sugar to express sizes with unit prefixes. More...
 
constexpr std::size_t operator""_GB (unsigned long long value) noexcept
 Syntax sugar to express sizes with unit prefixes. More...