Pass string views by value
string_view should always be passed by value; This commit is a sed
replace of the code to make all string_views pass by value, per general
coding guidelines[1].
[1] https://quuxplusone.github.io/blog/2021/11/09/pass-string-view-by-value/
Tested: Code compiles.
Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: I55b342a29a0fbfce0a4ed9ea63db6014d03b134c
diff --git a/http/routing.hpp b/http/routing.hpp
index 5b3ddfe..ae63f05 100644
--- a/http/routing.hpp
+++ b/http/routing.hpp
@@ -422,7 +422,7 @@
return *p;
}
- self_t& name(const std::string_view name) noexcept
+ self_t& name(std::string_view name) noexcept
{
self_t* self = static_cast<self_t*>(this);
self->nameStr = name;
@@ -663,7 +663,7 @@
}
template <typename Func>
- void operator()(const std::string_view name, Func&& f)
+ void operator()(std::string_view name, Func&& f)
{
nameStr = name;
(*this).template operator()<Func>(std::forward(f));
@@ -807,7 +807,7 @@
}
std::pair<unsigned, RoutingParams>
- find(const std::string_view reqUrl, const Node* node = nullptr,
+ find(std::string_view reqUrl, const Node* node = nullptr,
size_t pos = 0, RoutingParams* params = nullptr) const
{
RoutingParams empty;