aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/SVector.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/SVector.h')
-rw-r--r--src/SVector.h24
1 files changed, 6 insertions, 18 deletions
diff --git a/src/SVector.h b/src/SVector.h
index 9f56da528..7b929190d 100644
--- a/src/SVector.h
+++ b/src/SVector.h
@@ -23,7 +23,6 @@ class SVector {
int *v; ///< The vector
unsigned int size; ///< Number of elements allocated
unsigned int len; ///< Number of elements used in vector
- bool allocFailure; ///< A memory allocation call has failed
/** Internally allocate more elements than the user wants
* to avoid thrashing the memory allocator. */
@@ -33,12 +32,8 @@ class SVector {
else
newSize = (newSize * 3) / 2;
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];
}
@@ -51,7 +46,6 @@ class SVector {
public:
SVector() {
- allocFailure = false;
v = 0;
len = 0;
size = 0;
@@ -61,33 +55,27 @@ public:
}
/// Constructor from another vector.
SVector(const SVector &other) {
- allocFailure = false;
v = 0;
len = 0;
size = 0;
if (other.Length() > 0) {
SizeTo(other.Length());
- if (!allocFailure) {
- for (int i=0;i<other.Length();i++)
- v[i] = other.v[i];
- len = other.Length();
- }
+ for (int i=0;i<other.Length();i++)
+ v[i] = other.v[i];
+ len = other.Length();
}
}
/// Copy constructor.
SVector &operator=(const SVector &other) {
if (this != &other) {
delete []v;
- allocFailure = false;
v = 0;
len = 0;
size = 0;
if (other.Length() > 0) {
SizeTo(other.Length());
- if (!allocFailure) {
- for (int i=0;i<other.Length();i++)
- v[i] = other.v[i];
- }
+ for (int i=0;i<other.Length();i++)
+ v[i] = other.v[i];
len = other.Length();
}
}