From 61795739f8f45c5de4cfd0fe57af459146c5173c Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Wed, 16 Nov 2011 18:06:30 +0100 Subject: COMMON: Rename Common::set_to to Common::fill. This makes the name match with the name of the STL function with the same behavior. --- common/algorithm.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'common/algorithm.h') diff --git a/common/algorithm.h b/common/algorithm.h index e7ccef4840..d6790afbe9 100644 --- a/common/algorithm.h +++ b/common/algorithm.h @@ -73,25 +73,25 @@ Out copy_if(In first, In last, Out dst, Op op) { return dst; } -// Our 'specialized' 'set_to' template for char, signed char and unsigned char arrays. +// Our 'specialized' 'fill' template for char, signed char and unsigned char arrays. // Since C++ doesn't support partial specialized template functions (currently) we // are going this way... // With this we assure the usage of memset for those, which should be -// faster than a simple loop like for the generic 'set_to'. +// faster than a simple loop like for the generic 'fill'. template -signed char *set_to(signed char *first, signed char *last, Value val) { +signed char *fill(signed char *first, signed char *last, Value val) { memset(first, (val & 0xFF), last - first); return last; } template -unsigned char *set_to(unsigned char *first, unsigned char *last, Value val) { +unsigned char *fill(unsigned char *first, unsigned char *last, Value val) { memset(first, (val & 0xFF), last - first); return last; } template -char *set_to(char *first, char *last, Value val) { +char *fill(char *first, char *last, Value val) { memset(first, (val & 0xFF), last - first); return last; } @@ -100,7 +100,7 @@ char *set_to(char *first, char *last, Value val) { * Sets all elements in the range [first, last) to val. */ template -In set_to(In first, In last, Value val) { +In fill(In first, In last, Value val) { while (first != last) *first++ = val; return first; -- cgit v1.2.3 From c2fd35c9ed32820f9bc616c0e9fd23075c845a2e Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Wed, 16 Nov 2011 18:16:40 +0100 Subject: COMMON: Make value parameter of fill a const reference. --- common/algorithm.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'common/algorithm.h') diff --git a/common/algorithm.h b/common/algorithm.h index d6790afbe9..7a0eed89ce 100644 --- a/common/algorithm.h +++ b/common/algorithm.h @@ -100,7 +100,7 @@ char *fill(char *first, char *last, Value val) { * Sets all elements in the range [first, last) to val. */ template -In fill(In first, In last, Value val) { +In fill(In first, In last, const Value &val) { while (first != last) *first++ = val; return first; -- cgit v1.2.3