summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--documentapi/src/vespa/documentapi/messagebus/messages/testandsetcondition.h8
-rw-r--r--storage/src/vespa/storage/distributor/externaloperationhandler.cpp2
-rw-r--r--vespalib/src/tests/stllike/string_test.cpp19
-rw-r--r--vespalib/src/vespa/vespalib/stllike/string.h22
4 files changed, 4 insertions, 47 deletions
diff --git a/documentapi/src/vespa/documentapi/messagebus/messages/testandsetcondition.h b/documentapi/src/vespa/documentapi/messagebus/messages/testandsetcondition.h
index 6b8fc87d7ce..4ed291ecd68 100644
--- a/documentapi/src/vespa/documentapi/messagebus/messages/testandsetcondition.h
+++ b/documentapi/src/vespa/documentapi/messagebus/messages/testandsetcondition.h
@@ -2,20 +2,18 @@
// @author Vegard Sjonfjell
#pragma once
-#include <vespa/vespalib/stllike/string.h>
-
namespace documentapi {
class TestAndSetCondition {
private:
- vespalib::string _selection;
+ std::string _selection;
public:
TestAndSetCondition()
: _selection()
{}
- explicit TestAndSetCondition(vespalib::stringref selection)
+ TestAndSetCondition(vespalib::stringref selection)
: _selection(selection)
{}
@@ -25,7 +23,7 @@ public:
TestAndSetCondition(TestAndSetCondition &&) = default;
TestAndSetCondition & operator=(TestAndSetCondition &&) = default;
- const vespalib::string & getSelection() const { return _selection; }
+ const std::string & getSelection() const { return _selection; }
bool isPresent() const { return !_selection.empty(); }
};
diff --git a/storage/src/vespa/storage/distributor/externaloperationhandler.cpp b/storage/src/vespa/storage/distributor/externaloperationhandler.cpp
index 3f3924df229..90906e2bdf1 100644
--- a/storage/src/vespa/storage/distributor/externaloperationhandler.cpp
+++ b/storage/src/vespa/storage/distributor/externaloperationhandler.cpp
@@ -282,7 +282,7 @@ bool put_is_from_reindexing_visitor(const api::PutCommand& cmd) {
// Precondition: put_is_from_reindexing_visitor(cmd) == true
std::string extract_reindexing_token(const api::PutCommand& cmd) {
- const auto& tas_str = cmd.getCondition().getSelection();
+ const std::string& tas_str = cmd.getCondition().getSelection();
auto eq_idx = tas_str.find_first_of('=');
if (eq_idx != std::string::npos) {
return tas_str.substr(eq_idx + 1);
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.
*