util/IterableSplitString: return std::string_view

This commit is contained in:
Max Kellermann 2022-06-30 20:31:23 +02:00
parent ea3f044cd8
commit 02fe857755
2 changed files with 4 additions and 6 deletions

View File

@ -38,7 +38,7 @@ CurlEscapeUriPath(CURL *curl, std::string_view src) noexcept
std::string dest; std::string dest;
for (const auto i : IterableSplitString(src, '/')) { for (const auto i : IterableSplitString(src, '/')) {
CurlString escaped(curl_easy_escape(curl, i.data, i.size)); CurlString escaped(curl_easy_escape(curl, i.data(), i.size()));
if (!dest.empty()) if (!dest.empty())
dest.push_back('/'); dest.push_back('/');
dest += escaped.c_str(); dest += escaped.c_str();

View File

@ -30,9 +30,9 @@
#pragma once #pragma once
#include "StringSplit.hxx" #include "StringSplit.hxx"
#include "StringView.hxx"
#include <iterator> #include <iterator>
#include <string_view>
/** /**
* Split a string at a certain separator character into sub strings * Split a string at a certain separator character into sub strings
@ -47,8 +47,6 @@ class BasicIterableSplitString {
using string_view = std::basic_string_view<T>; using string_view = std::basic_string_view<T>;
using value_type = typename string_view::value_type; using value_type = typename string_view::value_type;
using StringView = BasicStringView<T>;
string_view s; string_view s;
value_type separator; value_type separator;
@ -100,11 +98,11 @@ public:
return !(*this == other); return !(*this == other);
} }
constexpr StringView operator*() const noexcept { constexpr string_view operator*() const noexcept {
return current; return current;
} }
constexpr const StringView *operator->() const noexcept { constexpr const string_view *operator->() const noexcept {
return &current; return &current;
} }
}; };