summaryrefslogtreecommitdiff
path: root/apt-pkg/contrib/string_view.h
diff options
context:
space:
mode:
Diffstat (limited to 'apt-pkg/contrib/string_view.h')
-rw-r--r--apt-pkg/contrib/string_view.h17
1 files changed, 6 insertions, 11 deletions
diff --git a/apt-pkg/contrib/string_view.h b/apt-pkg/contrib/string_view.h
index b062517b6..6224e2ac4 100644
--- a/apt-pkg/contrib/string_view.h
+++ b/apt-pkg/contrib/string_view.h
@@ -15,6 +15,11 @@
#include <cstring>
#include <string>
+#if APT_PKG_ABI > 600
+namespace APT {
+using StringView = std::string_view;
+}
+#else
namespace APT {
/**
@@ -146,17 +151,6 @@ inline std::ostream& operator<<(std::ostream& os, const StringView& sv)
return os << static_cast<std::string_view>(sv);
}
-/**
- * \brief Faster comparison for string views (compare size before data)
- *
- * Still stable, but faster than the normal ordering. */
-static inline int StringViewCompareFast(const std::string_view & a, const std::string_view & b) {
- if (a.size() != b.size())
- return a.size() - b.size();
-
- return a.compare(b);
-}
-
static constexpr inline APT::StringView operator""_sv(const char *data, size_t size)
{
return APT::StringView(data, size);
@@ -168,5 +162,6 @@ inline bool operator ==(const char *other, APT::StringView that) { return that.o
template<class = void> bool operator ==(std::string_view const &other, APT::StringView const &that) { return that.operator==(other); }
template<class = void> bool operator !=(std::string_view const &other, APT::StringView const &that) { return that.operator!=(other); }
template<class = void> bool operator !=(APT::StringView const &that, std::string_view const &other) { return that.operator!=(other); }
+#endif
#endif