Skip to content

Commit

Permalink
Return unique_ptr by value to allow RVO
Browse files Browse the repository at this point in the history
  • Loading branch information
mkrzewic authored and dennisklein committed Oct 31, 2018
1 parent 6ac94b7 commit cbab764
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions fairmq/MemoryResourceTools.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,13 @@ FairMQMessagePtr getMessage(ContainerT &&container_, FairMQMemoryResource *targe
container.data())));
if (message)
message->SetUsedSize(containerSizeBytes);
return std::move(message);
return message;
} else {
auto message = targetResource->getTransportFactory()->CreateMessage(containerSizeBytes);
std::memcpy(static_cast<fair::mq::byte *>(message->GetData()),
container.data(),
containerSizeBytes);
return std::move(message);
return message;
}
};

Expand Down

0 comments on commit cbab764

Please sign in to comment.