diff options
Diffstat (limited to 'src/SplitVector.h')
| -rw-r--r-- | src/SplitVector.h | 8 | 
1 files changed, 8 insertions, 0 deletions
diff --git a/src/SplitVector.h b/src/SplitVector.h index 342be02ad..9d62aef72 100644 --- a/src/SplitVector.h +++ b/src/SplitVector.h @@ -181,6 +181,14 @@ public:  			gapLength -= insertLength;  		}  	} + +	/// Ensure at least length elements allocated,  +	/// appending zero valued elements if needed. +	void EnsureLength(int wantedLength) { +		if (Length() < wantedLength) { +			InsertValue(Length(), wantedLength - Length(), 0); +		} +	}  	/// Insert text into the buffer from an array.  	void InsertFromArray(int positionToInsert, const T s[], int positionFrom, int insertLength) {  | 
