aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authornyamatongwe <unknown>2000-07-10 12:34:21 +0000
committernyamatongwe <unknown>2000-07-10 12:34:21 +0000
commit5494e069c7302bcaf61a640a0412870a432f964b (patch)
tree623ae378763aa83df870fb0f6df587d82fc0510a /src
parent7fbee89bae51b6713d4862e0e851a9c3e6ef5777 (diff)
downloadscintilla-mirror-5494e069c7302bcaf61a640a0412870a432f964b.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.h2
-rw-r--r--src/SVector.h17
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);