summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2018-01-31 22:45:19 +0300
committerAndrei Karas <akaras@inbox.ru>2018-01-31 22:45:19 +0300
commite4527d501cf73ef545894dfba5cc763d9476759d (patch)
treefa361d358c5b1ce713d5af7d67914d8b2df8fd75 /src
parent4ec9d3a629305e72d8dc81006080a2622bb90a32 (diff)
downloadplus-e4527d501cf73ef545894dfba5cc763d9476759d.tar.gz
plus-e4527d501cf73ef545894dfba5cc763d9476759d.tar.bz2
plus-e4527d501cf73ef545894dfba5cc763d9476759d.tar.xz
plus-e4527d501cf73ef545894dfba5cc763d9476759d.zip
Convert function isWordSeparator into constexpr function.
Diffstat (limited to 'src')
-rw-r--r--src/utils/stringutils.cpp9
-rw-r--r--src/utils/stringutils.h9
2 files changed, 8 insertions, 10 deletions
diff --git a/src/utils/stringutils.cpp b/src/utils/stringutils.cpp
index 6ec7817ed..0cece6d0a 100644
--- a/src/utils/stringutils.cpp
+++ b/src/utils/stringutils.cpp
@@ -154,15 +154,6 @@ int compareStrI(const std::string &a, const std::string &b)
return 1;
}
-
-bool isWordSeparator(const signed char chr)
-{
- return chr == ' ' ||
- chr == ',' ||
- chr == '.' ||
- chr == '"';
-}
-
const std::string findSameSubstring(const std::string &restrict str1,
const std::string &restrict str2)
{
diff --git a/src/utils/stringutils.h b/src/utils/stringutils.h
index abcbc6b07..cb4bbb332 100644
--- a/src/utils/stringutils.h
+++ b/src/utils/stringutils.h
@@ -136,7 +136,14 @@ int compareStrI(const std::string &a, const std::string &b) A_WARN_UNUSED;
/**
* Tells wether the character is a word separator.
*/
-bool isWordSeparator(const signed char chr) A_CONST A_WARN_UNUSED;
+constexpr bool isWordSeparator(const signed char chr) A_CONST A_WARN_UNUSED;
+constexpr bool isWordSeparator(const signed char chr)
+{
+ return chr == ' ' ||
+ chr == ',' ||
+ chr == '.' ||
+ chr == '"';
+}
size_t findI(std::string str, std::string subStr) A_WARN_UNUSED;