diff options
author | Björn Steinbrink <B.Steinbrink@gmx.de> | 2006-03-08 23:38:35 +0000 |
---|---|---|
committer | Björn Steinbrink <B.Steinbrink@gmx.de> | 2006-03-08 23:38:35 +0000 |
commit | 3bd2abeeffe9fb9b23293975b159ee2ddc868e5b (patch) | |
tree | 4d08e6b7568c6fca7dbf5a889016f61676c498e1 | |
parent | 0aca9d9da8a0817d0651168620c985a6813bf954 (diff) | |
download | mana-3bd2abeeffe9fb9b23293975b159ee2ddc868e5b.tar.gz mana-3bd2abeeffe9fb9b23293975b159ee2ddc868e5b.tar.bz2 mana-3bd2abeeffe9fb9b23293975b159ee2ddc868e5b.tar.xz mana-3bd2abeeffe9fb9b23293975b159ee2ddc868e5b.zip |
Use fill_n instead of for-loop.
-rw-r--r-- | ChangeLog | 1 | ||||
-rw-r--r-- | src/lockedarray.h | 5 |
2 files changed, 4 insertions, 2 deletions
@@ -1,5 +1,6 @@ 2006-03-09 Björn Steinbrink <B.Steinbrink@gmx.de> + * src/lockedarray.h: Use fill_n instead of for-loop. * src/gui/browserbox.cpp: Make the MouseOverLink functor dynamic and use a STL algorithm in one more place. diff --git a/src/lockedarray.h b/src/lockedarray.h index 53b111bd..13cbbda7 100644 --- a/src/lockedarray.h +++ b/src/lockedarray.h @@ -24,6 +24,8 @@ #ifndef _TMW_LOCKEDARRAY_H #define _TMW_LOCKEDARRAY_H +#include <algorithm> + /** * A _very_ basic array class that allows simple iteration and jumps, keeping * its currently selected entry and providing a mechanism to lock this @@ -66,8 +68,7 @@ template<class T> LockedArray<T>::LockedArray(unsigned int size): mSize(size), mData(new T[size]), mCurEntry(0), mLocked(false) { - for (unsigned int i = 0; i < mSize; i++) - mData[i] = 0; + std::fill_n(mData, mSize, (T)0); } template<class T> |