Also see Example 4: Using the UnsynchronizedBufferMemoryResource class
#include <gtest/gtest.h>
TEST(example_05_array_memory_resource, example_0)
{
static_assert(
alignof(
std::max_align_t) < 128,
"Wow, what hardware are you running on?");
void* r = nullptr;
#ifdefined(__cpp_exceptions)
try
{
#endif
r = resource.allocate(64, 128);
#ifdefined(__cpp_exceptions)
{
}
#endif
}
TEST(example_05_array_memory_resource, example_1)
{
resource.deallocate(r, 64, 128);
}
Defines a memory_resource type backed by an array data member and using cetl::pf17 types.
Defines a type compatible with C++17 std::byte.
Implementation of cetl::pf17::pmr::memory_resource that uses cetl::pmr::UnsynchronizedBufferMemoryRes...
Definition array_memory_resource.hpp:45
void * allocate(std::size_t size_bytes, std::size_t alignment=alignof(std::max_align_t))
Allocate memory.
Definition memory_resource.hpp:74