20class secure_memory_allocator {
24 using difference_type = ptrdiff_t;
28 using other = secure_memory_allocator<U>;
31 constexpr secure_memory_allocator() noexcept {};
36 constexpr secure_memory_allocator(secure_memory_allocator<U>
const &other)
noexcept
40 [[nodiscard]] value_type *allocate(size_type n)
const noexcept
42 auto allocator = std::allocator<std::byte>{};
43 auto *p = std::allocator_traits<
decltype(allocator)>::allocate(allocator, n *
sizeof (value_type));
44 return reinterpret_cast<value_type *
>(p);
47 void deallocate(value_type *p, size_type n)
const noexcept
51 auto allocator = std::allocator<std::byte>{};
52 std::allocator_traits<
decltype(allocator)>::deallocate(allocator,
reinterpret_cast<std::byte *
>(p), n *
sizeof (value_type));