File tree Expand file tree Collapse file tree 1 file changed +27
-5
lines changed Expand file tree Collapse file tree 1 file changed +27
-5
lines changed Original file line number Diff line number Diff line change @@ -51,7 +51,32 @@ class sbuffer {
5151 ::free (m_data);
5252 }
5353
54- public:
54+ #if !defined(MSGPACK_USE_CPP03)
55+ sbuffer (const sbuffer&) = delete;
56+ sbuffer& operator =(const sbuffer&) = delete ;
57+
58+ sbuffer (sbuffer&& other) :
59+ m_size(other.m_size), m_data(other.m_data), m_alloc(other.m_alloc)
60+ {
61+ other.m_size = other.m_alloc = 0 ;
62+ other.m_data = nullptr ;
63+ }
64+
65+ sbuffer& operator =(sbuffer&& other)
66+ {
67+ ::free (m_data);
68+
69+ m_size = other.m_size ;
70+ m_alloc = other.m_alloc ;
71+ m_data = other.m_data ;
72+
73+ other.m_size = other.m_alloc = 0 ;
74+ other.m_data = nullptr ;
75+
76+ return *this ;
77+ }
78+ #endif // !defined(MSGPACK_USE_CPP03)
79+
5580 void write (const char * buf, size_t len)
5681 {
5782 if (m_alloc - m_size < len) {
@@ -118,10 +143,7 @@ class sbuffer {
118143private:
119144 sbuffer (const sbuffer&);
120145 sbuffer& operator =(const sbuffer&);
121- #else // defined(MSGPACK_USE_CPP03)
122- sbuffer (const sbuffer&) = delete;
123- sbuffer& operator =(const sbuffer&) = delete ;
124- #endif // defined(MSGPACK_USE_CPP03)
146+ #endif // defined(MSGPACK_USE_CPP03)
125147
126148private:
127149 size_t m_size;
You can’t perform that action at this time.
0 commit comments