| 40 | |
| 41 | class _LIBCPP_HIDDEN __new_delete_memory_resource_imp : public memory_resource { |
| 42 | void* do_allocate(size_t bytes, size_t align) override { |
| 43 | #if _LIBCPP_HAS_ALIGNED_ALLOCATION |
| 44 | return std::__libcpp_allocate<std::byte>(__element_count(bytes), align); |
| 45 | #else |
| 46 | if (bytes == 0) |
| 47 | bytes = 1; |
| 48 | std::byte* result = std::__libcpp_allocate<std::byte>(__element_count(bytes), align); |
| 49 | if (!is_aligned_to(result, align)) { |
| 50 | std::__libcpp_deallocate<std::byte>(result, __element_count(bytes), align); |
| 51 | std::__throw_bad_alloc(); |
| 52 | } |
| 53 | return result; |
| 54 | #endif |
| 55 | } |
| 56 | |
| 57 | void do_deallocate(void* p, size_t bytes, size_t align) override { |
| 58 | std::__libcpp_deallocate<std::byte>(static_cast<std::byte*>(p), __element_count(bytes), align); |
no test coverage detected