summaryrefslogtreecommitdiff
path: root/src/lockedarray.h
diff options
context:
space:
mode:
authorBjörn Steinbrink <B.Steinbrink@gmx.de>2006-03-08 23:38:35 +0000
committerBjörn Steinbrink <B.Steinbrink@gmx.de>2006-03-08 23:38:35 +0000
commit3bd2abeeffe9fb9b23293975b159ee2ddc868e5b (patch)
tree4d08e6b7568c6fca7dbf5a889016f61676c498e1 /src/lockedarray.h
parent0aca9d9da8a0817d0651168620c985a6813bf954 (diff)
downloadmana-3bd2abeeffe9fb9b23293975b159ee2ddc868e5b.tar.gz
mana-3bd2abeeffe9fb9b23293975b159ee2ddc868e5b.tar.bz2
mana-3bd2abeeffe9fb9b23293975b159ee2ddc868e5b.tar.xz
mana-3bd2abeeffe9fb9b23293975b159ee2ddc868e5b.zip
Use fill_n instead of for-loop.
Diffstat (limited to 'src/lockedarray.h')
-rw-r--r--src/lockedarray.h5
1 files changed, 3 insertions, 2 deletions
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>