Skip to content

Commit

Permalink
use universal reference to support rvalue. (#1883)
Browse files Browse the repository at this point in the history
* use universal reference to support rvalue.

Signed-off-by: Tomoya Fujita <Tomoya.Fujita@sony.com>
  • Loading branch information
fujitatomoya committed Feb 10, 2022
1 parent 891fff0 commit 4c8cfa3
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion rclcpp/include/rclcpp/create_publisher.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ template<
typename NodeT>
std::shared_ptr<PublisherT>
create_publisher(
NodeT & node,
NodeT && node,
const std::string & topic_name,
const rclcpp::QoS & qos,
const rclcpp::PublisherOptionsWithAllocator<AllocatorT> & options = (
Expand Down
11 changes: 11 additions & 0 deletions rclcpp/test/rclcpp/test_publisher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,17 @@ TEST_F(TestPublisher, various_creation_signatures) {
rclcpp::create_publisher<Empty>(node, "topic", 42, options);
(void)publisher;
}
{
auto publisher = rclcpp::create_publisher<Empty>(
node->get_node_topics_interface(), "topic", 42, rclcpp::PublisherOptions());
(void)publisher;
}
{
auto node_topics_interface = node->get_node_topics_interface();
auto publisher = rclcpp::create_publisher<Empty>(
node_topics_interface, "topic", 42, rclcpp::PublisherOptions());
(void)publisher;
}
{
auto node_parameters = node->get_node_parameters_interface();
auto node_topics = node->get_node_topics_interface();
Expand Down

0 comments on commit 4c8cfa3

Please sign in to comment.