From 94db751716dd2851f99b5c4c2981da1d1f4780f8 Mon Sep 17 00:00:00 2001 From: Daniel Wilhelm Date: Fri, 2 Oct 2015 14:53:20 +0200 Subject: 6.11 --- zen/string_tools.h | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) (limited to 'zen/string_tools.h') diff --git a/zen/string_tools.h b/zen/string_tools.h index a0b02d14..addf2bd5 100644 --- a/zen/string_tools.h +++ b/zen/string_tools.h @@ -82,7 +82,7 @@ bool isWhiteSpace(wchar_t ch) { return std::iswspace(ch) != 0; } template inline bool isDigit(Char ch) //similar to implmenetation of std::::isdigit()! { - assert_static((IsSameType::value || IsSameType::value)); + static_assert(IsSameType::value || IsSameType::value, ""); return static_cast('0') <= ch && ch <= static_cast('9'); } @@ -90,7 +90,7 @@ bool isDigit(Char ch) //similar to implmenetation of std::::isdigit()! template inline bool startsWith(const S& str, const T& prefix) { - assert_static(IsStringLike::value && IsStringLike::value); + static_assert(IsStringLike::value && IsStringLike::value, ""); typedef typename GetCharType::Type CharType; const size_t pfLength = strLength(prefix); @@ -106,7 +106,7 @@ bool startsWith(const S& str, const T& prefix) template inline bool endsWith(const S& str, const T& postfix) { - assert_static(IsStringLike::value && IsStringLike::value); + static_assert(IsStringLike::value && IsStringLike::value, ""); typedef typename GetCharType::Type CharType; const size_t strLen = strLength(str); @@ -123,7 +123,7 @@ bool endsWith(const S& str, const T& postfix) template inline bool contains(const S& str, const T& term) { - assert_static(IsStringLike::value && IsStringLike::value); + static_assert(IsStringLike::value && IsStringLike::value, ""); typedef typename GetCharType::Type CharType; const size_t strLen = strLength(str); @@ -144,7 +144,7 @@ bool contains(const S& str, const T& term) template inline S afterLast(const S& str, const T& term) { - assert_static(IsStringLike::value); + static_assert(IsStringLike::value, ""); typedef typename GetCharType::Type CharType; const size_t termLen = strLength(term); @@ -167,7 +167,7 @@ S afterLast(const S& str, const T& term) template inline S beforeLast(const S& str, const T& term) { - assert_static(IsStringLike::value); + static_assert(IsStringLike::value, ""); typedef typename GetCharType::Type CharType; const CharType* const strFirst = strBegin(str); @@ -187,7 +187,7 @@ S beforeLast(const S& str, const T& term) template inline S afterFirst(const S& str, const T& term) { - assert_static(IsStringLike::value); + static_assert(IsStringLike::value, ""); typedef typename GetCharType::Type CharType; const size_t termLen = strLength(term); @@ -209,7 +209,7 @@ S afterFirst(const S& str, const T& term) template inline S beforeFirst(const S& str, const T& term) { - assert_static(IsStringLike::value); + static_assert(IsStringLike::value, ""); typedef typename GetCharType::Type CharType; const CharType* const strFirst = strBegin(str); @@ -223,7 +223,7 @@ S beforeFirst(const S& str, const T& term) template inline std::vector split(const S& str, const T& delimiter) { - assert_static(IsStringLike::value); + static_assert(IsStringLike::value, ""); typedef typename GetCharType::Type CharType; std::vector output; @@ -245,7 +245,7 @@ std::vector split(const S& str, const T& delimiter) const CharType* const blockEnd = std::search(blockStart, strLast, delimFirst, delimLast); - output.push_back(S(blockStart, blockEnd - blockStart)); + output.emplace_back(blockStart, blockEnd - blockStart); if (blockEnd == strLast) break; blockStart = blockEnd + delimLen; @@ -271,7 +271,7 @@ typename EnableIf::value>::Type stringAppend(S& str, const template inline S replaceCpy(const S& str, const T& oldTerm, const U& newTerm, bool replaceAll) { - assert_static(IsStringLike::value && IsStringLike::value); + static_assert(IsStringLike::value && IsStringLike::value, ""); typedef typename GetCharType::Type CharType; const size_t oldLen = strLength(oldTerm); @@ -395,10 +395,10 @@ int saferPrintf(wchar_t* buffer, size_t bufferSize, const wchar_t* format, const template inline S printNumber(const T& format, const Num& number) //format a single number using ::sprintf { - assert_static(IsStringLike::value); - assert_static((IsSameType< - typename GetCharType::Type, - typename GetCharType::Type>::value)); + static_assert(IsStringLike::value, ""); + static_assert(IsSameType< + typename GetCharType::Type, + typename GetCharType::Type>::value, ""); typedef typename GetCharType::Type CharType; -- cgit