0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-12-24 14:34:00 +01:00

ircd::buffer: Add unique_buffer ctor for mutable to const move conversion.

This commit is contained in:
Jason Volk 2023-04-04 12:51:04 -07:00
parent b260bd85a7
commit 32d4d44662

View file

@ -32,6 +32,7 @@ struct ircd::buffer::unique_buffer
unique_buffer() = default;
unique_buffer(const size_t &size, const size_t &align = 0);
explicit unique_buffer(const const_buffer &);
template<class T> unique_buffer(unique_buffer<T> &&) noexcept;
unique_buffer(unique_buffer &&) noexcept;
unique_buffer(const unique_buffer &) = delete;
unique_buffer &operator=(unique_buffer &&) & noexcept;
@ -71,6 +72,19 @@ ircd::buffer::unique_buffer<buffer_type>::unique_buffer(const size_t &size,
}
{}
template<class buffer_type>
template<class other_type>
inline
ircd::buffer::unique_buffer<buffer_type>::unique_buffer(unique_buffer<other_type> &&other)
noexcept
:buffer_type
{
other.release()
}
{
assert(std::get<0>(other) == nullptr);
}
template<class buffer_type>
inline
ircd::buffer::unique_buffer<buffer_type>::unique_buffer(unique_buffer &&other)