mirror of
https://github.com/gabime/spdlog.git
synced 2025-09-30 02:19:35 +08:00
proper swap and move operations on swap oss
This commit is contained in:
@@ -19,9 +19,6 @@ public:
|
||||
static const unsigned short stack_size = STACK_SIZE;
|
||||
stack_buf() :_v(), _stack_size(0) {}
|
||||
~stack_buf() = default;
|
||||
|
||||
stack_buf& operator=(const stack_buf& other) = delete;
|
||||
|
||||
stack_buf(const stack_buf& other):stack_buf(other, delegate_copy_move {})
|
||||
{}
|
||||
|
||||
@@ -29,6 +26,16 @@ public:
|
||||
{
|
||||
other.clear();
|
||||
}
|
||||
template<class T1>
|
||||
stack_buf& operator=(T1&& other)
|
||||
{
|
||||
_stack_size = other._stack_size;
|
||||
if (other.vector_used())
|
||||
_v = std::forward<T1>(other)._v;
|
||||
else
|
||||
std::copy_n(other._stack_array.begin(), other._stack_size, _stack_array.begin());
|
||||
return *this;
|
||||
}
|
||||
|
||||
void append(const char* buf, std::size_t buf_size)
|
||||
{
|
||||
@@ -62,14 +69,6 @@ public:
|
||||
_v.clear();
|
||||
}
|
||||
|
||||
/* bufpair_t get() const
|
||||
{
|
||||
if (vector_used())
|
||||
return bufpair_t(_v.data(), _v.size());
|
||||
else
|
||||
return bufpair_t(_stack_array.data(), _stack_size);
|
||||
}*/
|
||||
|
||||
const char* data() const
|
||||
{
|
||||
if (vector_used())
|
||||
|
Reference in New Issue
Block a user