mirror of
https://github.com/VCMP-SqMod/SqMod.git
synced 2024-11-08 08:47:17 +01:00
Implement stealing the memory from POCO buffer.
So I don't have to allocate one if I don't have to.
This commit is contained in:
parent
81893bf236
commit
d787803fd8
10
vendor/POCO/Foundation/include/Poco/Buffer.h
vendored
10
vendor/POCO/Foundation/include/Poco/Buffer.h
vendored
@ -259,6 +259,16 @@ public:
|
|||||||
swap(_ownMem, other._ownMem);
|
swap(_ownMem, other._ownMem);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
T* steal()
|
||||||
|
/// Releases ownership of the buffer. Whoever gets hold of the buffer must invoke delete [] on it.
|
||||||
|
{
|
||||||
|
T* ptr = _ptr;
|
||||||
|
_ptr = 0;
|
||||||
|
_capacity = _used = 0; // Retrieve this before calling this method
|
||||||
|
_ownMem = false; // Consult this before calling this method
|
||||||
|
return ptr;
|
||||||
|
}
|
||||||
|
|
||||||
bool operator == (const Buffer& other) const
|
bool operator == (const Buffer& other) const
|
||||||
/// Compare operator.
|
/// Compare operator.
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user