mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-25 17:12:03 +00:00
███████████: development [#METR-8766].
This commit is contained in:
parent
1e44f91f00
commit
ccc3da3148
@ -20,12 +20,12 @@ namespace DB
|
||||
*/
|
||||
struct Memory : boost::noncopyable
|
||||
{
|
||||
size_t m_capacity;
|
||||
size_t m_size;
|
||||
char * m_data;
|
||||
size_t alignment;
|
||||
size_t m_capacity = 0;
|
||||
size_t m_size = 0;
|
||||
char * m_data = nullptr;
|
||||
size_t alignment = 0;
|
||||
|
||||
Memory() : m_capacity(0), m_size(0), m_data(NULL), alignment(0) {}
|
||||
Memory() {}
|
||||
|
||||
/// Если alignment != 0, то будет выделяться память, выровненная на alignment.
|
||||
Memory(size_t size_, size_t alignment_ = 0) : m_capacity(size_), m_size(m_capacity), alignment(alignment_)
|
||||
@ -38,6 +38,21 @@ struct Memory : boost::noncopyable
|
||||
dealloc();
|
||||
}
|
||||
|
||||
Memory(Memory && rhs)
|
||||
{
|
||||
*this = std::move(rhs);
|
||||
}
|
||||
|
||||
Memory & operator=(Memory && rhs)
|
||||
{
|
||||
std::swap(m_capacity, rhs.m_capacity);
|
||||
std::swap(m_size, rhs.m_size);
|
||||
std::swap(m_data, rhs.m_data);
|
||||
std::swap(alignment, rhs.alignment);
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
size_t size() const { return m_size; }
|
||||
const char & operator[](size_t i) const { return m_data[i]; }
|
||||
char & operator[](size_t i) { return m_data[i]; }
|
||||
|
Loading…
Reference in New Issue
Block a user