| 105 | } |
| 106 | |
| 107 | allocation_slot stack_allocator::copy_buffer(span<char const> buf) |
| 108 | { |
| 109 | auto const ret = m_storage.size(); |
| 110 | auto const size = numeric_cast<std::size_t>(buf.size()); |
| 111 | if (size < 1) return {}; |
| 112 | |
| 113 | if (std::numeric_limits<int>::max() - size <= ret) |
| 114 | return {}; |
| 115 | m_storage.resize(ret + size); |
| 116 | std::memcpy(&m_storage[ret], buf.data(), numeric_cast<std::size_t>(size)); |
| 117 | return allocation_slot(ret); |
| 118 | } |
| 119 | |
| 120 | allocation_slot stack_allocator::allocate(int const bytes) |
| 121 | { |