Skip to content

Commit

Permalink
Updates to not use std::move in some places. (#2353)
Browse files Browse the repository at this point in the history
gcc 13.1.1 complains that these uses inhibit copy elision.

Signed-off-by: Chris Lalancette <[email protected]>
  • Loading branch information
clalancette authored Nov 5, 2023
1 parent 76e2b26 commit 7f41137
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions rclcpp/include/rclcpp/experimental/intra_process_manager.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -467,7 +467,7 @@ class IntraProcessManager
auto ptr = MessageAllocTraits::allocate(allocator, 1);
MessageAllocTraits::construct(allocator, ptr, *message);

subscription->provide_intra_process_data(std::move(MessageUniquePtr(ptr, deleter)));
subscription->provide_intra_process_data(MessageUniquePtr(ptr, deleter));
}

continue;
Expand Down Expand Up @@ -510,7 +510,7 @@ class IntraProcessManager
MessageAllocTraits::construct(allocator, ptr, *message);

ros_message_subscription->provide_intra_process_message(
std::move(MessageUniquePtr(ptr, deleter)));
MessageUniquePtr(ptr, deleter));
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion rclcpp/include/rclcpp/publisher.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,7 @@ class Publisher : public PublisherBase
if (this->can_loan_messages()) {
// we release the ownership from the rclpp::LoanedMessage instance
// and let the middleware clean up the memory.
this->do_loaned_message_publish(std::move(loaned_msg.release()));
this->do_loaned_message_publish(loaned_msg.release());
} else {
// we don't release the ownership, let the middleware copy the ros message
// and thus the destructor of rclcpp::LoanedMessage cleans up the memory.
Expand Down
2 changes: 1 addition & 1 deletion rclcpp/test/rclcpp/test_publisher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -482,7 +482,7 @@ class TestPublisherProtectedMethods : public rclcpp::Publisher<MessageT, Allocat

void publish_loaned_message(rclcpp::LoanedMessage<MessageT, AllocatorT> && loaned_msg)
{
this->do_loaned_message_publish(std::move(loaned_msg.release()));
this->do_loaned_message_publish(loaned_msg.release());
}

void call_default_incompatible_qos_callback(rclcpp::QOSOfferedIncompatibleQoSInfo & event) const
Expand Down

0 comments on commit 7f41137

Please sign in to comment.