Used perfect forwarding in Coroutine::start

This commit is contained in:
MHaselmaier 2021-05-03 12:07:03 +02:00
parent 019ca7f579
commit 19e9c59b62
2 changed files with 5 additions and 5 deletions

View File

@ -597,8 +597,8 @@ public:
* @return - &id:oatpp::async::CoroutineStarter;.
*/
template<typename ...ConstructorArgs>
static CoroutineStarter start(ConstructorArgs... args) {
return new T(args...);
static CoroutineStarter start(ConstructorArgs&&... args) {
return new T(std::forward<ConstructorArgs>(args)...);
}
/**

View File

@ -158,9 +158,9 @@ oatpp::async::CoroutineStarter Request::sendAsync(std::shared_ptr<Request> _this
std::shared_ptr<oatpp::data::stream::BufferOutputStream> m_headersWriteBuffer;
public:
SendAsyncCoroutine(const std::shared_ptr<Request>& request,
SendAsyncCoroutine(std::shared_ptr<Request> request,
const std::shared_ptr<data::stream::OutputStream>& stream)
: m_this(request)
: m_this(std::move(request))
, m_stream(stream)
, m_headersWriteBuffer(std::make_shared<oatpp::data::stream::BufferOutputStream>())
{}
@ -231,7 +231,7 @@ oatpp::async::CoroutineStarter Request::sendAsync(std::shared_ptr<Request> _this
};
return SendAsyncCoroutine::start(_this, stream);
return SendAsyncCoroutine::start(std::move(_this), stream);
}