mirror of
				https://gitea.osmocom.org/cellular-infrastructure/osmo-trx.git
				synced 2025-11-03 21:53:18 +00:00 
			
		
		
		
	vector: Introduce shrink() function to shrink vector size without loosing data.
Change-Id: I9c0ac2715aea1a90c9e6ebcd982522b80a547099
This commit is contained in:
		@@ -92,6 +92,13 @@ template <class T> class Vector {
 | 
				
			|||||||
		mEnd = mStart + newSize;
 | 
							mEnd = mStart + newSize;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						/** Reduce addressable size of the Vector, keeping content. */
 | 
				
			||||||
 | 
						void shrink(size_t newSize)
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							assert(newSize <= mEnd - mStart);
 | 
				
			||||||
 | 
							mEnd = mStart + newSize;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/** Release memory and clear pointers. */
 | 
						/** Release memory and clear pointers. */
 | 
				
			||||||
	void clear() { resize(0); }
 | 
						void clear() { resize(0); }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user