diff options
author | Yuri Gorshenin <y@maps.me> | 2016-06-22 00:10:23 +0300 |
---|---|---|
committer | Yuri Gorshenin <y@maps.me> | 2016-06-22 00:10:23 +0300 |
commit | 3dcca2c16d45bd7e45fc8a8c6d4e519015d5acc7 (patch) | |
tree | 343863a671cbeb6d2eaeafbbee8912d84578b620 /base | |
parent | 62f35230b410717dc2a3c286a6cf208ff8fbab1f (diff) |
[base] Removed TokenizeIterator default ctor.
Diffstat (limited to 'base')
-rw-r--r-- | base/base_tests/string_utils_test.cpp | 6 | ||||
-rw-r--r-- | base/string_utils.cpp | 10 | ||||
-rw-r--r-- | base/string_utils.hpp | 14 |
3 files changed, 9 insertions, 21 deletions
diff --git a/base/base_tests/string_utils_test.cpp b/base/base_tests/string_utils_test.cpp index 564e51fcbe..1f1aa05bc2 100644 --- a/base/base_tests/string_utils_test.cpp +++ b/base/base_tests/string_utils_test.cpp @@ -411,12 +411,6 @@ UNIT_TEST(SimpleTokenizer) tokens.assign(&s[0], &s[0] + ARRAY_SIZE(s)); TestIter("/1/2/", "/", tokens); } - { - using strings::SimpleTokenizer; - string const str("a,b,c"); - TEST_EQUAL(vector<string>(SimpleTokenizer(str, ","), SimpleTokenizer()), - (vector<string>{"a", "b", "c"}), ()); - } { string const s = ""; diff --git a/base/string_utils.cpp b/base/string_utils.cpp index d36b33a853..7b6b808995 100644 --- a/base/string_utils.cpp +++ b/base/string_utils.cpp @@ -24,12 +24,14 @@ SimpleDelimiter::SimpleDelimiter(char const * delims) m_delims.push_back(utf8::unchecked::next(it)); } +SimpleDelimiter::SimpleDelimiter(char delim) +{ + m_delims.push_back(delim); +} + bool SimpleDelimiter::operator()(UniChar c) const { - for (UniString::const_iterator it = m_delims.begin(); it != m_delims.end(); ++it) - if (*it == c) - return true; - return false; + return find(m_delims.begin(), m_delims.end(), c) != m_delims.end(); } UniChar LastUniChar(string const & s) diff --git a/base/string_utils.hpp b/base/string_utils.hpp index c114748369..d557706d85 100644 --- a/base/string_utils.hpp +++ b/base/string_utils.hpp @@ -113,10 +113,6 @@ public: Move(); } - // Use default-constructed iterator for operator == to determine the - // end of the token stream. - TokenizeIterator() = default; - string operator*() const { ASSERT(m_start != m_finish, ("Dereferencing of empty iterator.")); @@ -204,10 +200,6 @@ public: ++m_end; } - // Use default-constructed iterator for operator == to determine the - // end of the token stream. - TokenizeIterator() = default; - string operator*() const { ASSERT(!m_finished, ("Dereferencing of empty iterator.")); @@ -290,9 +282,9 @@ class SimpleDelimiter public: SimpleDelimiter(char const * delims); - // Used in TokenizeIterator to allow past the end iterator construction. - SimpleDelimiter() = default; - /// @return true if c is delimiter + SimpleDelimiter(char delim); + + // Returns true iff |c| is a delimiter. bool operator()(UniChar c) const; }; |