From 9446470f3c434a21314ce5e3204e5a98b38bb83e Mon Sep 17 00:00:00 2001 From: q66 Date: Wed, 22 Jul 2015 21:10:04 +0100 Subject: [PATCH] use ConstCharRange for concat separator --- ostd/string.hh | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/ostd/string.hh b/ostd/string.hh index 57e6b59..3940daf 100644 --- a/ostd/string.hh +++ b/ostd/string.hh @@ -623,9 +623,9 @@ inline namespace literals { inline namespace string_literals { } } } -template -AnyString concat(AllocatorArg, const A &alloc, const T &v, const S &sep, - F func) { +template +AnyString concat(AllocatorArg, const A &alloc, const T &v, + ConstCharRange sep, F func) { AnyString ret(alloc); auto range = ostd::iter(v); if (range.empty()) return ret; @@ -638,9 +638,9 @@ AnyString concat(AllocatorArg, const A &alloc, const T &v, const S &sep, return ret; } -template +template AnyString concat(AllocatorArg, const A &alloc, const T &v, - const S &sep = " ") { + ConstCharRange sep = " ") { AnyString ret(alloc); auto range = ostd::iter(v); if (range.empty()) return ret; @@ -653,35 +653,35 @@ AnyString concat(AllocatorArg, const A &alloc, const T &v, return ret; } -template -String concat(const T &v, const S &sep, F func) { +template +String concat(const T &v, ConstCharRange sep, F func) { return concat(allocator_arg, typename String::Allocator(), v, sep, func); } -template -String concat(const T &v, const S &sep = " ") { +template +String concat(const T &v, ConstCharRange sep = " ") { return concat(allocator_arg, typename String::Allocator(), v, sep); } -template +template AnyString concat(AllocatorArg, const A &alloc, - std::initializer_list v, const S &sep, F func) { + std::initializer_list v, ConstCharRange sep, F func) { return concat(allocator_arg, alloc, ostd::iter(v), sep, func); } -template +template AnyString concat(AllocatorArg, const A &alloc, - std::initializer_list v, const S &sep = " ") { + std::initializer_list v, ConstCharRange sep = " ") { return concat(allocator_arg, alloc, ostd::iter(v), sep); } -template -String concat(std::initializer_list v, const S &sep, F func) { +template +String concat(std::initializer_list v, ConstCharRange sep, F func) { return concat(ostd::iter(v), sep, func); } -template -String concat(std::initializer_list v, const S &sep = " ") { +template +String concat(std::initializer_list v, ConstCharRange sep = " ") { return concat(ostd::iter(v), sep); }