16class secure_memory_allocator {
20 using difference_type = ptrdiff_t;
24 using other = secure_memory_allocator<U>;
27 constexpr secure_memory_allocator() noexcept {};
32 constexpr secure_memory_allocator(secure_memory_allocator<U>
const &other)
noexcept
36 [[nodiscard]] value_type *allocate(size_type n)
const noexcept
38 auto allocator = std::allocator<std::byte>{};
39 auto *p = std::allocator_traits<
decltype(allocator)>::allocate(allocator, n *
sizeof (value_type));
40 return reinterpret_cast<value_type *
>(p);
43 void deallocate(value_type *p, size_type n)
const noexcept
47 auto allocator = std::allocator<std::byte>{};
48 std::allocator_traits<
decltype(allocator)>::deallocate(allocator,
reinterpret_cast<std::byte *
>(p), n *
sizeof (value_type));