ice
ice copied to clipboard
move sent callback into outgoing
The CustomLambdaOutgoing constructor uses std::move to assign the sent callback from the corresponding parameter, but the caller in the generated code is not passing a lreference. There is a missing call to std::move(sent) below.
::std::function<void()>
Demo::ThroughputPrx::echoByteSeqAsync(const ::std::pair<const ::Ice::Byte*, const ::Ice::Byte*>& iceP_seq,
::std::function<void (::std::pair<const ::Ice::Byte*, const ::Ice::Byte*>)> response,
::std::function<void(::std::exception_ptr)> ex,
::std::function<void(bool)> sent,
const ::Ice::Context& context)
{
_checkTwowayOnly(iceC_Demo_Throughput_echoByteSeq_name);
...
auto outAsync = ::std::make_shared<::IceInternal::CustomLambdaOutgoing>(shared_from_this(), read, ex, sent);
clang-tidy suggest that we should use a const reference for sent:
warning: the parameter 'sent' is copied for each invocation but only used as a const reference; consider making it a const reference [performance-unnecessary-value-param]
::std::function<void(bool)> sent,
But I think is more appropriate to use std::move and keep it as a value type