Avoid string_view::clear:

String views are cleared using assignment from
braced initializion, to avoid calling clear().
This commit is contained in:
Vinnie Falco
2018-01-22 11:26:23 -08:00
parent 2b32de6cba
commit ad42096a9d
3 changed files with 11 additions and 10 deletions

View File

@@ -4,6 +4,7 @@ Version 153:
* Use make_error_code for setting an error_code from errc
* Use boost::winapi::GetLastError() consistently
* Update README.md for branches
* Avoid string_view::clear
--------------------------------------------------------------------------------

View File

@@ -352,8 +352,8 @@ increment()
{
it = first;
};
v.first.clear();
v.second.clear();
v.first = {};
v.second = {};
detail::skip_ows(it, last);
first = it;
if(it == last)

View File

@@ -364,8 +364,8 @@ basic_fields(basic_fields&& other) noexcept
, method_(other.method_)
, target_or_reason_(other.target_or_reason_)
{
other.method_.clear();
other.target_or_reason_.clear();
other.method_ = {};
other.target_or_reason_ = {};
}
template<class Allocator>
@@ -1221,7 +1221,7 @@ realloc_string(string_view& dest, string_view s)
{
a.deallocate(const_cast<char*>(
dest.data()), dest.size());
dest.clear();
dest = {};
}
if(! s.empty())
{
@@ -1249,7 +1249,7 @@ realloc_target(
{
a.deallocate(const_cast<char*>(
dest.data()), dest.size());
dest.clear();
dest = {};
}
if(! s.empty())
{
@@ -1305,8 +1305,8 @@ move_assign(basic_fields& other, std::true_type)
list_ = std::move(other.list_);
method_ = other.method_;
target_or_reason_ = other.target_or_reason_;
other.method_.clear();
other.target_or_reason_.clear();
other.method_ = {};
other.target_or_reason_ = {};
this->member() = other.member();
}
@@ -1328,8 +1328,8 @@ move_assign(basic_fields& other, std::false_type)
list_ = std::move(other.list_);
method_ = other.method_;
target_or_reason_ = other.target_or_reason_;
other.method_.clear();
other.target_or_reason_.clear();
other.method_ = {};
other.target_or_reason_ = {};
}
}