diff options
author | Johannes Hofmann <Johannes.Hofmann@gmx.de> | 2009-06-23 09:21:18 +0200 |
---|---|---|
committer | Johannes Hofmann <Johannes.Hofmann@gmx.de> | 2009-06-23 09:21:18 +0200 |
commit | 064a77fb31399521e031b6885f244c23f320baf0 (patch) | |
tree | f7c42b9a5715b91a8d2032fa281a838ebdab7153 /lout | |
parent | e4ea7136d1d08bb355f1acf3a73772055912d220 (diff) |
assert that SimpleVector size is positive
Diffstat (limited to 'lout')
-rw-r--r-- | lout/misc.hh | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/lout/misc.hh b/lout/misc.hh index fe93ae57..59ada437 100644 --- a/lout/misc.hh +++ b/lout/misc.hh @@ -138,14 +138,18 @@ public: * * May be necessary before calling misc::SimpleVector::set. */ - inline void increase() { this->num++; this->resize (); } + inline void increase() { setSize(this->num + 1); } /** * \brief Set the size explicitely. * * May be necessary before calling misc::SimpleVector::set. */ - inline void setSize(int newSize) { this->num = newSize; this->resize (); } + inline void setSize(int newSize) { + assert (newSize >= 0); + this->num = newSize; + this->resize (); + } /** * \brief Set the size explicitely and initialize new values. |