forked from OctaForge/libostd
use ConstCharRange for concat separator
parent
13ca140b63
commit
9446470f3c
|
@ -623,9 +623,9 @@ inline namespace literals { inline namespace string_literals {
|
||||||
}
|
}
|
||||||
} }
|
} }
|
||||||
|
|
||||||
template<typename A, typename T, typename F, typename S = const char *>
|
template<typename A, typename T, typename F>
|
||||||
AnyString<A> concat(AllocatorArg, const A &alloc, const T &v, const S &sep,
|
AnyString<A> concat(AllocatorArg, const A &alloc, const T &v,
|
||||||
F func) {
|
ConstCharRange sep, F func) {
|
||||||
AnyString<A> ret(alloc);
|
AnyString<A> ret(alloc);
|
||||||
auto range = ostd::iter(v);
|
auto range = ostd::iter(v);
|
||||||
if (range.empty()) return ret;
|
if (range.empty()) return ret;
|
||||||
|
@ -638,9 +638,9 @@ AnyString<A> concat(AllocatorArg, const A &alloc, const T &v, const S &sep,
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename A, typename T, typename S = const char *>
|
template<typename A, typename T>
|
||||||
AnyString<A> concat(AllocatorArg, const A &alloc, const T &v,
|
AnyString<A> concat(AllocatorArg, const A &alloc, const T &v,
|
||||||
const S &sep = " ") {
|
ConstCharRange sep = " ") {
|
||||||
AnyString<A> ret(alloc);
|
AnyString<A> ret(alloc);
|
||||||
auto range = ostd::iter(v);
|
auto range = ostd::iter(v);
|
||||||
if (range.empty()) return ret;
|
if (range.empty()) return ret;
|
||||||
|
@ -653,35 +653,35 @@ AnyString<A> concat(AllocatorArg, const A &alloc, const T &v,
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T, typename F, typename S = const char *>
|
template<typename T, typename F>
|
||||||
String concat(const T &v, const S &sep, F func) {
|
String concat(const T &v, ConstCharRange sep, F func) {
|
||||||
return concat(allocator_arg, typename String::Allocator(), v, sep, func);
|
return concat(allocator_arg, typename String::Allocator(), v, sep, func);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T, typename S = const char *>
|
template<typename T>
|
||||||
String concat(const T &v, const S &sep = " ") {
|
String concat(const T &v, ConstCharRange sep = " ") {
|
||||||
return concat(allocator_arg, typename String::Allocator(), v, sep);
|
return concat(allocator_arg, typename String::Allocator(), v, sep);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename A, typename T, typename F, typename S = const char *>
|
template<typename A, typename T, typename F>
|
||||||
AnyString<A> concat(AllocatorArg, const A &alloc,
|
AnyString<A> concat(AllocatorArg, const A &alloc,
|
||||||
std::initializer_list<T> v, const S &sep, F func) {
|
std::initializer_list<T> v, ConstCharRange sep, F func) {
|
||||||
return concat(allocator_arg, alloc, ostd::iter(v), sep, func);
|
return concat(allocator_arg, alloc, ostd::iter(v), sep, func);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename A, typename T, typename S = const char *>
|
template<typename A, typename T>
|
||||||
AnyString<A> concat(AllocatorArg, const A &alloc,
|
AnyString<A> concat(AllocatorArg, const A &alloc,
|
||||||
std::initializer_list<T> v, const S &sep = " ") {
|
std::initializer_list<T> v, ConstCharRange sep = " ") {
|
||||||
return concat(allocator_arg, alloc, ostd::iter(v), sep);
|
return concat(allocator_arg, alloc, ostd::iter(v), sep);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T, typename F, typename S = const char *>
|
template<typename T, typename F>
|
||||||
String concat(std::initializer_list<T> v, const S &sep, F func) {
|
String concat(std::initializer_list<T> v, ConstCharRange sep, F func) {
|
||||||
return concat(ostd::iter(v), sep, func);
|
return concat(ostd::iter(v), sep, func);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T, typename S = const char *>
|
template<typename T>
|
||||||
String concat(std::initializer_list<T> v, const S &sep = " ") {
|
String concat(std::initializer_list<T> v, ConstCharRange sep = " ") {
|
||||||
return concat(ostd::iter(v), sep);
|
return concat(ostd::iter(v), sep);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue