diff options
author | Sebastian Geerken <devnull@localhost> | 2014-03-02 11:14:40 +0100 |
---|---|---|
committer | Sebastian Geerken <devnull@localhost> | 2014-03-02 11:14:40 +0100 |
commit | d4369a8441bc6d4de5ade21cfb8f81152981d2e1 (patch) | |
tree | 13754f4fdc06eb1973013b71e8fe79e00f04dcfd /lout | |
parent | 975ba73389d2de0cd2bb50183bd988eab6ba0e06 (diff) |
Some assertions in NotSoSimpleVector.
Diffstat (limited to 'lout')
-rw-r--r-- | lout/misc.hh | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/lout/misc.hh b/lout/misc.hh index 2bb28b12..3082f33c 100644 --- a/lout/misc.hh +++ b/lout/misc.hh @@ -421,14 +421,17 @@ public: */ inline T* getRef (int i) const { - if (this->startExtra == -1) + if (this->startExtra == -1) { + assert (i >= 0 && i < this->numMain); return this->arrayMain + i; - else { - if (i < this->startExtra) + } else { + if (i < this->startExtra) { + assert (i >= 0); return this->arrayMain + i; - else if (i >= this->startExtra + this->numExtra) + } else if (i >= this->startExtra + this->numExtra) { + assert (i < this->numMain + this->numExtra); return this->arrayMain + i - this->numExtra; - else + } else return this->arrayExtra1 + i - this->startExtra; } } |