From 3bd2abeeffe9fb9b23293975b159ee2ddc868e5b Mon Sep 17 00:00:00 2001 From: Björn Steinbrink Date: Wed, 8 Mar 2006 23:38:35 +0000 Subject: Use fill_n instead of for-loop. --- src/lockedarray.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src') 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 + /** * 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 LockedArray::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 -- cgit v1.2.3-70-g09d2