summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog1
-rw-r--r--src/lockedarray.h5
2 files changed, 4 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 3caaf8f2..353b4aad 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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>