diff options
author | nyamatongwe <devnull@localhost> | 2000-07-10 12:34:21 +0000 |
---|---|---|
committer | nyamatongwe <devnull@localhost> | 2000-07-10 12:34:21 +0000 |
commit | 560565219161bc9fffb2bebda1fc13150059ba09 (patch) | |
tree | 623ae378763aa83df870fb0f6df587d82fc0510a /src | |
parent | a4b9ba8e601d1f2d0693a7edcd2fb4dd75fc583e (diff) | |
download | scintilla-mirror-560565219161bc9fffb2bebda1fc13150059ba09.tar.gz |
Dropped template as only ever instantiated for int and this allows
Scintilla to be template free.
Diffstat (limited to 'src')
-rw-r--r-- | src/CellBuffer.h | 2 | ||||
-rw-r--r-- | src/SVector.h | 17 |
2 files changed, 9 insertions, 10 deletions
diff --git a/src/CellBuffer.h b/src/CellBuffer.h index 7a3eabaeb..acac9fa2f 100644 --- a/src/CellBuffer.h +++ b/src/CellBuffer.h @@ -144,7 +144,7 @@ private: LineVector lv; - SVector<int, 4000> lineStates; + SVector lineStates; void GapTo(int position); void RoomFor(int insertionLength); diff --git a/src/SVector.h b/src/SVector.h index 9a260542b..d4d49c717 100644 --- a/src/SVector.h +++ b/src/SVector.h @@ -6,13 +6,12 @@ #ifndef SVECTOR_H #define SVECTOR_H -// A simple expandable vector. -// T must support assignment. +// A simple expandable integer vector. // Storage not allocated for elements until an element is used. // This makes it very lightweight unless used so is a good match for optional features. -template<class T, int sizeIncrement> + class SVector { - T *v; + int *v; unsigned int size; // Number of elements allocated unsigned int len; // Number of elements in vector bool allocFailure; // A memory allocation call has failed @@ -20,17 +19,17 @@ class SVector { // Internally allocate more elements than the user wants to avoid // thrashng the memory allocator void SizeTo(int newSize) { - if (newSize < sizeIncrement) - newSize += sizeIncrement; + if (newSize < 4000) + newSize += 4000; else newSize = (newSize * 3) / 2; - T* newv = new T[newSize]; + int* newv = new int[newSize]; if (!newv) { allocFailure = true; return; } size = newSize; - unsigned int i=0; + unsigned int i=0; for (; i<len; i++) { newv[i] = v[i]; } @@ -83,7 +82,7 @@ public: } return *this; } - T &operator[](unsigned int i) { + int &operator[](unsigned int i) { if (i >= len) { if (i >= size) { SizeTo(i); |