mirror of
				https://github.com/VCMP-SqMod/SqMod.git
				synced 2025-10-30 13:57:20 +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:
		
							
								
								
									
										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); | ||||
| 	} | ||||
|  | ||||
| 	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 | ||||
| 		/// Compare operator. | ||||
| 	{ | ||||
|   | ||||
		Reference in New Issue
	
	Block a user