[Scummvm-cvs-logs] SF.net SVN: scummvm: [29080] scummvm/trunk/common/algorithm.h
lordhoto at users.sourceforge.net
lordhoto at users.sourceforge.net
Mon Sep 24 02:07:29 CEST 2007
Revision: 29080
http://scummvm.svn.sourceforge.net/scummvm/?rev=29080&view=rev
Author: lordhoto
Date: 2007-09-23 17:07:28 -0700 (Sun, 23 Sep 2007)
Log Message:
-----------
Adds Common::set_to which sets elements from the range [first, last) to value.
Modified Paths:
--------------
scummvm/trunk/common/algorithm.h
Modified: scummvm/trunk/common/algorithm.h
===================================================================
--- scummvm/trunk/common/algorithm.h 2007-09-23 23:37:55 UTC (rev 29079)
+++ scummvm/trunk/common/algorithm.h 2007-09-24 00:07:28 UTC (rev 29080)
@@ -53,6 +53,15 @@
return dst;
}
+// TODO: this is can be slower than memset for most normal data
+// maybe specialize the template for char, short, int, long, long long
+template<class In, class Value>
+In set_to(In first, In last, Value val) {
+ while (first != last)
+ *first++ = val;
+ return first;
+}
+
template<class In, class T>
In find(In first, In last, const T &v) {
while (first != last) {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list