mirror of
https://github.com/matrix-construct/construct
synced 2025-01-13 16:33:53 +01:00
ircd::buffer: Support release() for unique_buffer.
This commit is contained in:
parent
6f75a1c8f8
commit
a7f43fe48d
1 changed files with 12 additions and 0 deletions
|
@ -18,6 +18,8 @@ template<class buffer,
|
|||
struct ircd::buffer::unique_buffer
|
||||
:buffer
|
||||
{
|
||||
buffer release();
|
||||
|
||||
unique_buffer(const size_t &size);
|
||||
unique_buffer(std::unique_ptr<char[]> &&, const size_t &size);
|
||||
explicit unique_buffer(const buffer &);
|
||||
|
@ -122,3 +124,13 @@ noexcept
|
|||
{
|
||||
delete[] data(*this);
|
||||
}
|
||||
|
||||
template<class buffer,
|
||||
uint alignment>
|
||||
buffer
|
||||
ircd::buffer::unique_buffer<buffer, alignment>::release()
|
||||
{
|
||||
const buffer ret{static_cast<buffer>(*this)};
|
||||
static_cast<buffer &>(*this) = buffer{};
|
||||
return ret;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue