mirror of
https://github.com/oatpp/oatpp.git
synced 2024-11-27 08:30:07 +08:00
Used perfect forwarding in Coroutine::start
This commit is contained in:
parent
019ca7f579
commit
19e9c59b62
@ -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)...);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -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);
|
||||
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user