Skip to content

Commit

Permalink
Replace detail::workspace::push uses with detail::workspace::emplace
Browse files Browse the repository at this point in the history
  • Loading branch information
ashtum committed Mar 22, 2024
1 parent 5f71eb1 commit 211cae2
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 21 deletions.
9 changes: 0 additions & 9 deletions include/boost/http_proto/detail/impl/workspace.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -112,15 +112,6 @@ emplace(Args&&... args) ->
return p->u;
}

template<class T>
auto
workspace::
push(T&& t) ->
typename std::decay<T>::type&
{
return emplace<T>(std::forward<T>(t));
}

template<class T>
T*
workspace::
Expand Down
4 changes: 0 additions & 4 deletions include/boost/http_proto/detail/workspace.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -132,10 +132,6 @@ class workspace
typename std::decay<T>::type&
emplace(Args&&... args);

template<class T>
typename std::decay<T>::type&
push(T&& t);

template<class T>
T*
push_array(
Expand Down
11 changes: 5 additions & 6 deletions include/boost/http_proto/impl/parser.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,10 @@ set_body(
if(! got_header())
detail::throw_logic_error();

auto& dyn = ws_.push(
auto& dyn = ws_.emplace<
buffers::any_dynamic_buffer_impl<typename
std::decay<ElasticBuffer>::type,
buffers_N>(std::forward<
ElasticBuffer>(eb)));
buffers_N>>(std::forward<ElasticBuffer>(eb));
eb_ = &dyn;
how_ = how::elastic;
on_set_body();
Expand All @@ -81,10 +80,10 @@ set_body(
if(! got_header())
detail::throw_logic_error();

auto& dyn = ws_.push(
auto& dyn = ws_.emplace<
buffers::any_dynamic_buffer_impl<typename
std::decay<ElasticBuffer>::type&,
buffers_N>(eb));
buffers_N>>(eb);
eb_ = &dyn;
how_ = how::elastic;
on_set_body();
Expand All @@ -109,7 +108,7 @@ set_body(
if(! got_header())
detail::throw_logic_error();

auto& s = ws_.push(
auto& s = ws_.emplace<Sink>(
std::forward<Sink>(sink));
sink_ = &s;
how_ = how::sink;
Expand Down
4 changes: 2 additions & 2 deletions include/boost/http_proto/impl/serializer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@ start(
{
start_init(m);
auto const& bs =
ws_.push(std::forward<
ConstBufferSequence>(body));
ws_.emplace<ConstBufferSequence>(
std::forward<ConstBufferSequence>(body));
std::size_t n = std::distance(
buffers::begin(bs),
buffers::end(bs));
Expand Down

0 comments on commit 211cae2

Please sign in to comment.