summaryrefslogtreecommitdiff
path: root/zen/string_tools.h
diff options
context:
space:
mode:
authorB Stack <bgstack15@gmail.com>2019-11-20 08:36:44 -0500
committerB Stack <bgstack15@gmail.com>2019-11-20 08:36:44 -0500
commited50041589974d31296cb30dc1897f7fba6336c2 (patch)
treee2c5c7b1f98e64011b1ee8ca4e9bb9157510dfe7 /zen/string_tools.h
parentMerge branch '10.17' into 'master' (diff)
downloadFreeFileSync-ed50041589974d31296cb30dc1897f7fba6336c2.tar.gz
FreeFileSync-ed50041589974d31296cb30dc1897f7fba6336c2.tar.bz2
FreeFileSync-ed50041589974d31296cb30dc1897f7fba6336c2.zip
add upstream 10.18
Diffstat (limited to 'zen/string_tools.h')
-rw-r--r--zen/string_tools.h17
1 files changed, 9 insertions, 8 deletions
diff --git a/zen/string_tools.h b/zen/string_tools.h
index dcb5a54a..7f9a07ff 100644
--- a/zen/string_tools.h
+++ b/zen/string_tools.h
@@ -32,7 +32,7 @@ template <class Char> Char asciiToLower(Char c);
template <class Char> Char asciiToUpper(Char c);
//both S and T can be strings or char/wchar_t arrays or single char/wchar_t
-template <class S, class T> bool contains(const S& str, const T& term);
+template <class S, class T, typename = std::enable_if_t<IsStringLikeV<S>>> bool contains(const S& str, const T& term);
template <class S, class T> bool startsWith (const S& str, const T& prefix);
template <class S, class T> bool startsWithAsciiNoCase(const S& str, const T& prefix);
@@ -103,7 +103,6 @@ template <class T, class S> T copyStringTo(S&& str);
-
//---------------------- implementation ----------------------
template <class Char> inline
bool isWhiteSpace(Char c)
@@ -279,7 +278,7 @@ int compareAsciiNoCase(const S& lhs, const T& rhs)
}
-template <class S, class T> inline
+template <class S, class T, typename> inline
bool contains(const S& str, const T& term)
{
static_assert(std::is_same_v<GetCharTypeT<S>, GetCharTypeT<T>>);
@@ -415,15 +414,15 @@ std::vector<S> split(const S& str, const T& delimiter, SplitType st)
namespace impl
{
-ZEN_INIT_DETECT_MEMBER(append);
+ZEN_INIT_DETECT_MEMBER(append)
//either call operator+=(S(str, len)) or append(str, len)
-template <class S, class InputIterator> inline
-std::enable_if_t<HasMember_append<S>::value> stringAppend(S& str, InputIterator first, InputIterator last) { str.append(first, last); }
+template <class S, class InputIterator, typename = std::enable_if_t<HasMemberV_append<S>>> inline
+void stringAppend(S& str, InputIterator first, InputIterator last) { str.append(first, last); }
//inefficient append: keep disabled until really needed
-//template <class S, class InputIterator> inline
-//std::enable_if_t<!HasMember_append<S>::value> stringAppend(S& str, InputIterator first, InputIterator last) { str += S(first, last); }
+//template <class S, class InputIterator, typename = std::enable_if_t<!HasMemberV_append<S>>> inline
+//void stringAppend(S& str, InputIterator first, InputIterator last) { str += S(first, last); }
}
@@ -850,6 +849,8 @@ char unhexify(char high, char low)
};
return static_cast<unsigned char>(16 * unhexifyDigit(high) + unhexifyDigit(low)); //[!] convert to unsigned char first, then to char (which may be signed)
}
+
+
}
#endif //STRING_TOOLS_H_213458973046
bgstack15