diff options
author | Tor Brede Vekterli <vekterli@yahooinc.com> | 2022-03-24 14:44:39 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-03-24 14:44:39 +0100 |
commit | b05068ec3bce60ddde43474d400db00a75f4f16c (patch) | |
tree | 5bfb6975feff9da21ae6b9d2bedf04ebc3baa0a0 /vespalib | |
parent | a905bb7584c4057f59cf77a354492b140cac1a77 (diff) |
Revert "Use vespalib::string in TestAndSetCondition"
Diffstat (limited to 'vespalib')
-rw-r--r-- | vespalib/src/tests/stllike/string_test.cpp | 19 | ||||
-rw-r--r-- | vespalib/src/vespa/vespalib/stllike/string.h | 22 |
2 files changed, 0 insertions, 41 deletions
diff --git a/vespalib/src/tests/stllike/string_test.cpp b/vespalib/src/tests/stllike/string_test.cpp index d60380aa3ab..de384bce9ad 100644 --- a/vespalib/src/tests/stllike/string_test.cpp +++ b/vespalib/src/tests/stllike/string_test.cpp @@ -489,23 +489,4 @@ TEST("test that empty_string is shared and empty") { EXPECT_EQUAL(empty_string(), ""); } -TEST("starts_with has expected semantics for small_string") { - vespalib::string a("foobar"); - EXPECT_TRUE(a.starts_with("")); - EXPECT_TRUE(a.starts_with("foo")); - EXPECT_TRUE(a.starts_with("foobar")); - EXPECT_FALSE(a.starts_with("foobarf")); - EXPECT_FALSE(a.starts_with("oobar")); -} - -TEST("starts_with has expected semantics for stringref") { - vespalib::string a("foobar"); - vespalib::stringref ar(a); - EXPECT_TRUE(ar.starts_with("")); - EXPECT_TRUE(ar.starts_with("foo")); - EXPECT_TRUE(ar.starts_with("foobar")); - EXPECT_FALSE(ar.starts_with("foobarf")); - EXPECT_FALSE(ar.starts_with("oobar")); -} - TEST_MAIN() { TEST_RUN_ALL(); } diff --git a/vespalib/src/vespa/vespalib/stllike/string.h b/vespalib/src/vespa/vespalib/stllike/string.h index 2e61d7ef0e9..2c0bb9a85d3 100644 --- a/vespalib/src/vespa/vespalib/stllike/string.h +++ b/vespalib/src/vespa/vespalib/stllike/string.h @@ -111,7 +111,6 @@ public: } return npos; } - /** * Find the last occurrence of a substring, starting at e and * searching in reverse order. @@ -127,17 +126,6 @@ public: int diff(memcmp(_s, s, std::min(sz, size()))); return (diff != 0) ? diff : (size() - sz); } - - /** - * Returns true iff input string is a prefix of this string. - */ - [[nodiscard]] bool starts_with(stringref prefix) const noexcept { - if (prefix.size() > size()) { - return false; - } - return (memcmp(data(), prefix.data(), prefix.size()) == 0); - } - const char & operator [] (size_t i) const { return _s[i]; } operator std::string () const { return std::string(_s, _sz); } bool operator < (const char * s) const noexcept { return compare(s, strlen(s)) < 0; } @@ -269,16 +257,6 @@ public: } /** - * Returns true iff input string is a prefix of this string. - */ - [[nodiscard]] bool starts_with(stringref prefix) const noexcept { - if (prefix.size() > size()) { - return false; - } - return (memcmp(buffer(), prefix.data(), prefix.size()) == 0); - } - - /** * Find the last occurrence of a substring, starting at e and * searching in reverse order. * |