From 1cd811a4126fc474e58c9bdd39f1205b872da9cd Mon Sep 17 00:00:00 2001 From: Karsten Knese Date: Fri, 17 Apr 2020 15:02:13 -0700 Subject: [PATCH] make it compile on osx Signed-off-by: Karsten Knese --- rclcpp/include/rclcpp/create_subscription.hpp | 16 ++++++---------- rclcpp/include/rclcpp/subscription_traits.hpp | 6 ++++++ 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/rclcpp/include/rclcpp/create_subscription.hpp b/rclcpp/include/rclcpp/create_subscription.hpp index fb9ffea744..33a5c7b4b2 100644 --- a/rclcpp/include/rclcpp/create_subscription.hpp +++ b/rclcpp/include/rclcpp/create_subscription.hpp @@ -54,12 +54,10 @@ create_subscription( const rosidl_message_type_support_t & type_support, const rclcpp::QoS & qos, CallbackT && callback, - const rclcpp::SubscriptionOptionsWithAllocator & options = ( - rclcpp::SubscriptionOptionsWithAllocator() - ), - typename MessageMemoryStrategyT::SharedPtr msg_mem_strat = ( + const rclcpp::SubscriptionOptionsWithAllocator & options = + rclcpp::SubscriptionOptionsWithAllocator(), + typename MessageMemoryStrategyT::SharedPtr msg_mem_strat = MessageMemoryStrategyT::create_default() - ) ) { using rclcpp::node_interfaces::get_node_topics_interface; @@ -96,12 +94,10 @@ create_subscription( const std::string & topic_name, const rclcpp::QoS & qos, CallbackT && callback, - const rclcpp::SubscriptionOptionsWithAllocator & options = ( - rclcpp::SubscriptionOptionsWithAllocator() - ), - typename MessageMemoryStrategyT::SharedPtr msg_mem_strat = ( + const rclcpp::SubscriptionOptionsWithAllocator & options = + rclcpp::SubscriptionOptionsWithAllocator(), + typename MessageMemoryStrategyT::SharedPtr msg_mem_strat = MessageMemoryStrategyT::create_default() - ) ) { const auto type_support = *rosidl_typesupport_cpp::get_message_type_support_handle(); diff --git a/rclcpp/include/rclcpp/subscription_traits.hpp b/rclcpp/include/rclcpp/subscription_traits.hpp index ecab458bd7..c6d35a8423 100644 --- a/rclcpp/include/rclcpp/subscription_traits.hpp +++ b/rclcpp/include/rclcpp/subscription_traits.hpp @@ -18,6 +18,7 @@ #include #include "rclcpp/function_traits.hpp" +#include "rclcpp/subscription_options.hpp" #include "rcl/types.h" namespace rclcpp @@ -75,6 +76,7 @@ struct extract_message_type>: extract_message template< typename CallbackT, + typename AllocatorT = std::allocator, // Do not attempt if CallbackT is an integer (mistaken for depth) typename = std::enable_if_t>>::value>, @@ -85,6 +87,10 @@ template< // Do not attempt if CallbackT is a rmw_qos_profile_t (mistaken for qos profile) typename = std::enable_if_t>>::value>, + // Do not attempt if CallbackT is a rclcpp::SubscriptionOptionsWithAllocator + typename = std::enable_if_t, std::remove_cv_t>>::value> > struct has_message_type : extract_message_type<