| 53 | void deallocate(T* ptr, [[maybe_unused]] std::size_t n) { std::free(ptr); } |
| 54 | }; |
| 55 | |
| 56 | template <typename T> |
| 57 | struct Allocator { |
| 58 | public: |
| 59 | using value_type = T; |
| 60 | |
| 61 | constexpr Allocator() noexcept = default; |
| 62 | |
| 63 | template <typename U> |
| 64 | explicit constexpr Allocator(const Allocator<U>&) noexcept {} |
| 65 | |
| 66 | [[nodiscard]] constexpr T* allocate(std::size_t n) { return ::new T[n]; } |
| 67 | |
| 68 | constexpr void deallocate(T* ptr, [[maybe_unused]] size_t n) noexcept { |
| 69 | ::delete[] ptr; |
| 70 | } |
| 71 | |
| 72 | // Intercept zero-argument construction to do default initialization. |
| 73 | template <typename U> |
| 74 | void construct(U* ptr) noexcept(std::is_nothrow_default_constructible_v<U>) { |
| 75 | ::new (static_cast<void*>(ptr)) U; |
| 76 | } |
| 77 | }; |
| 78 |
nothing calls this directly
no outgoing calls
no test coverage detected