36 std::unique_ptr<char[]> data(
new char[x]);
37 size_t newSize = std::min(
m_size, x);
58 m_data(new char[size_])
64 m_data(new char[size_])
66 std::copy(data, data+size_,
m_data.get());
70 m_reserve(x.m_reserve),
72 m_data(
std::move(x.m_data))
84 m_data = std::move(x.m_data);
107 if(size_ > m_reserve)
109 m_data.reset(
new char[size_]);
113 std::copy(data, data+size_, m_data.get());
void assign(const char *const data, const size_t size_)
Assign a sequence a data to the block.
size_t size() const
See the relevant data size.
size_t m_reserve
Total bytes allocated.
size_t m_size
Size of relevant part of data allocation.
std::unique_ptr< char[]> m_data
Point to allocated data.
Declares the Block data structure.
size_t reserve() const
See the reserve size.
void clear()
Deallocate memory and set size and reserve to zero.
Block & operator=(Block &&x)
Steal the data from another block.
Block()
Initialize an empty block.
Data structure to hold a block of raw data.