alloc/raw/linear: enable move operators
This commit is contained in:
parent
dee4a155e3
commit
2e0b51baa4
@ -22,6 +22,26 @@ linear::linear (cruft::view<std::byte*> _data):
|
||||
{ ; }
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
linear::linear (linear &&rhs)
|
||||
: m_begin (std::exchange (rhs.m_begin, nullptr))
|
||||
, m_end (std::exchange (rhs.m_end, nullptr))
|
||||
, m_cursor (std::exchange (rhs.m_cursor, nullptr))
|
||||
{ ; }
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
linear&
|
||||
linear::operator= (cruft::alloc::raw::linear &&rhs)
|
||||
{
|
||||
m_begin = std::exchange (rhs.m_begin, nullptr);
|
||||
m_end = std::exchange (rhs.m_end, nullptr);
|
||||
m_cursor = std::exchange (rhs.m_cursor, nullptr);
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
std::byte*
|
||||
linear::data (void)
|
||||
|
@ -21,9 +21,10 @@ namespace cruft::alloc::raw {
|
||||
class linear {
|
||||
public:
|
||||
linear (const linear&) = delete;
|
||||
linear (linear&&) = delete;
|
||||
linear& operator= (const linear&) = delete;
|
||||
linear& operator= (linear&&) = delete;
|
||||
|
||||
linear (linear&&);
|
||||
linear& operator= (linear&&);
|
||||
|
||||
linear (cruft::view<std::byte*> _data);
|
||||
|
||||
@ -98,8 +99,8 @@ namespace cruft::alloc::raw {
|
||||
size_t remain (void) const;
|
||||
|
||||
protected:
|
||||
std::byte *const m_begin;
|
||||
std::byte *const m_end;
|
||||
std::byte *m_begin;
|
||||
std::byte *m_end;
|
||||
std::byte *m_cursor;
|
||||
};
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user