diff options
| author | Neil <nyamatongwe@gmail.com> | 2017-05-10 13:58:06 +1000 | 
|---|---|---|
| committer | Neil <nyamatongwe@gmail.com> | 2017-05-10 13:58:06 +1000 | 
| commit | 91c4a9ff07821dce93dab3ffd77df081893b723d (patch) | |
| tree | 04717f8b9f4c64280f07cc6c2d402e2753700683 /src/SparseVector.h | |
| parent | 1d41f1635e3a01bd99f0beb689c4d3ff6fea6e30 (diff) | |
| download | scintilla-mirror-91c4a9ff07821dce93dab3ffd77df081893b723d.tar.gz | |
Use unique_ptr fpr Partitioning, RunStyles, SparseVector, PositionCache and
Document.
Diffstat (limited to 'src/SparseVector.h')
| -rw-r--r-- | src/SparseVector.h | 14 | 
1 files changed, 6 insertions, 8 deletions
| diff --git a/src/SparseVector.h b/src/SparseVector.h index 250ce97ac..39324bdc1 100644 --- a/src/SparseVector.h +++ b/src/SparseVector.h @@ -17,8 +17,8 @@ namespace Scintilla {  template <typename T>  class SparseVector {  private: -	Partitioning *starts; -	SplitVector<T> *values; +	std::unique_ptr<Partitioning> starts; +	std::unique_ptr<SplitVector<T>> values;  	// Deleted so SparseVector objects can not be copied.  	SparseVector(const SparseVector &) = delete;  	void operator=(const SparseVector &) = delete; @@ -55,19 +55,17 @@ private:  	}  public:  	SparseVector() { -		starts = new Partitioning(8); -		values = new SplitVector<T>(); +		starts.reset(new Partitioning(8)); +		values.reset(new SplitVector<T>());  		values->InsertValue(0, 2, T());  	}  	~SparseVector() { -		delete starts; -		starts = NULL; +		starts.reset();  		// starts dead here but not used by ClearValue.  		for (int part = 0; part < values->Length(); part++) {  			ClearValue(part);  		} -		delete values; -		values = NULL; +		values.reset();  	}  	int Length() const {  		return starts->PositionFromPartition(starts->Partitions()); | 
