Pass string_view by value

This commit is contained in:
Vinnie Falco
2017-07-12 16:35:52 -07:00
parent 32cd5e4082
commit b18d0d15b0
6 changed files with 24 additions and 18 deletions

View File

@@ -1,3 +1,9 @@
Version 81:
* Pass string_view by value
--------------------------------------------------------------------------------
Version 80:
* Javadoc tidying

View File

@@ -41,7 +41,7 @@ print(T const& t)
inline
void
string_param::
print(string_view const& sv)
print(string_view sv)
{
sv_ = sv;
}

View File

@@ -60,8 +60,8 @@ ascii_tolower(char c)
template<class = void>
bool
iequals(
beast::string_view const& lhs,
beast::string_view const& rhs)
beast::string_view lhs,
beast::string_view rhs)
{
auto n = lhs.size();
if(rhs.size() != n)
@@ -102,8 +102,8 @@ iequals(
inline
bool
iequals(
beast::string_view const& lhs,
beast::string_view const& rhs)
beast::string_view lhs,
beast::string_view rhs)
{
return detail::iequals(lhs, rhs);
}
@@ -116,8 +116,8 @@ struct iless
{
bool
operator()(
string_view const& lhs,
string_view const& rhs) const
string_view lhs,
string_view rhs) const
{
using std::begin;
using std::end;
@@ -139,8 +139,8 @@ struct iequal
{
bool
operator()(
string_view const& lhs,
string_view const& rhs) const
string_view lhs,
string_view rhs) const
{
return iequals(lhs, rhs);
}

View File

@@ -45,7 +45,7 @@ class string_param
print(T const&);
void
print(string_view const&);
print(string_view);
template<class T>
typename std::enable_if<

View File

@@ -28,7 +28,7 @@ struct field_table
struct hash
{
std::size_t
operator()(string_view const& s) const
operator()(string_view s) const
{
auto const n = s.size();
return
@@ -43,8 +43,8 @@ struct field_table
// assumes inputs have equal length
bool
operator()(
string_view const& lhs,
string_view const& rhs) const
string_view lhs,
string_view rhs) const
{
auto p1 = lhs.data();
auto p2 = rhs.data();

View File

@@ -737,7 +737,7 @@ template<class String, class Pred>
void
filter_token_list(
String& s,
string_view const& value,
string_view value,
Pred&& pred)
{
token_list te{value};
@@ -764,7 +764,7 @@ template<class String, class Pred>
void
filter_token_list_last(
String& s,
string_view const& value,
string_view value,
Pred&& pred)
{
token_list te{value};
@@ -801,7 +801,7 @@ filter_token_list_last(
template<class String>
void
keep_alive_impl(
String& s, string_view const& value,
String& s, string_view value,
unsigned version, bool keep_alive)
{
if(version < 11)
@@ -1025,7 +1025,7 @@ set_chunked_impl(bool value)
{
static_string<max_static_buffer> buf;
detail::filter_token_list_last(buf, it->value(),
[](string_view const& s)
[](string_view s)
{
return iequals(s, "chunked");
});
@@ -1050,7 +1050,7 @@ set_chunked_impl(bool value)
#endif
s.reserve(it->value().size());
detail::filter_token_list_last(s, it->value(),
[](string_view const& s)
[](string_view s)
{
return iequals(s, "chunked");
});