19class secure_memory_allocator {
23 using difference_type = ptrdiff_t;
27 using other = secure_memory_allocator<U>;
30 constexpr secure_memory_allocator() noexcept {};
35 constexpr secure_memory_allocator(secure_memory_allocator<U>
const &other)
noexcept
39 [[nodiscard]] value_type *allocate(size_type n)
const noexcept
41 auto allocator = std::allocator<std::byte>{};
42 auto *p = std::allocator_traits<
decltype(allocator)>::allocate(allocator, n *
sizeof (value_type));
43 return reinterpret_cast<value_type *
>(p);
46 void deallocate(value_type *p, size_type n)
const noexcept
50 auto allocator = std::allocator<std::byte>{};
51 std::allocator_traits<
decltype(allocator)>::deallocate(allocator,
reinterpret_cast<std::byte *
>(p), n *
sizeof (value_type));