4#ifndef WPI_MEMORY_DETAIL_FREE_LIST_ARRAY_HPP 
    5#define WPI_MEMORY_DETAIL_FREE_LIST_ARRAY_HPP 
   21            template <
class FreeList, 
class AccessPolicy>
 
   34                : no_elements_(AccessPolicy::index_from_size(
max_node_size) - min_size_index + 1)
 
   36                    array_ = 
static_cast<FreeList*
>(
 
   37                        stack.allocate(end, no_elements_ * 
sizeof(FreeList), 
alignof(FreeList)));
 
   39                    for (std::size_t i = 0u; i != no_elements_; ++i)
 
   41                        auto node_size = AccessPolicy::size_from_index(i + min_size_index);
 
   42                        ::new (
static_cast<void*
>(array_ + i)) FreeList(node_size);
 
 
   48                : array_(other.array_), no_elements_(other.no_elements_)
 
   50                    other.array_       = 
nullptr;
 
   51                    other.no_elements_ = 0u;
 
 
   59                    array_       = other.array_;
 
   60                    no_elements_ = other.no_elements_;
 
   62                    other.array_       = 
nullptr;
 
   63                    other.no_elements_ = 0u;
 
 
   68                FreeList& 
get(std::size_t node_size) 
const noexcept 
   70                    auto i = AccessPolicy::index_from_size(node_size);
 
   71                    if (i < min_size_index)
 
   73                    return array_[i - min_size_index];
 
 
   77                std::size_t 
size() const noexcept
 
 
   85                    return AccessPolicy::size_from_index(no_elements_ + min_size_index - 1);
 
 
   89                static const std::size_t min_size_index;
 
   92                std::size_t no_elements_;
 
 
   95            template <
class FL, 
class AP>
 
   96            const std::size_t free_list_array<FL, AP>::min_size_index =
 
   97                AP::index_from_size(FL::min_element_size);
 
Definition memory_stack.hpp:22
Definition free_list_array.hpp:23
~free_list_array() noexcept=default
std::size_t size() const noexcept
Definition free_list_array.hpp:77
free_list_array(free_list_array &&other) noexcept
Definition free_list_array.hpp:47
free_list_array(fixed_memory_stack &stack, const char *end, std::size_t max_node_size) noexcept
Definition free_list_array.hpp:32
std::size_t max_node_size() const noexcept
Definition free_list_array.hpp:83
FreeList & get(std::size_t node_size) const noexcept
Definition free_list_array.hpp:68
Alias template for an STL container that uses a certain RawAllocator.
Definition container.hpp:184
detail namespace with internal helper functions
Definition input_adapters.h:32
Memory namespace.
Definition heap_allocator.hpp:20
Foonathan namespace.
Definition ntcore_cpp.h:26
Definition free_list_array.hpp:102
static std::size_t index_from_size(std::size_t size) noexcept
Definition free_list_array.hpp:103
static std::size_t size_from_index(std::size_t index) noexcept
Definition free_list_array.hpp:108
Definition free_list_array.hpp:117
static std::size_t size_from_index(std::size_t index) noexcept
static std::size_t index_from_size(std::size_t size) noexcept
#define WPI_MEMORY_ASSERT_MSG(Expr, Msg)
Definition assert.hpp:47