From 949ef5d1dc751c3bdfad7e83c4d3d8b2bc110347 Mon Sep 17 00:00:00 2001 From: Esteve Fernandez Date: Mon, 18 May 2015 12:57:22 -0700 Subject: [PATCH] Added support for lambdas --- rclcpp/include/rclcpp/node.hpp | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/rclcpp/include/rclcpp/node.hpp b/rclcpp/include/rclcpp/node.hpp index c1a8943..888b962 100644 --- a/rclcpp/include/rclcpp/node.hpp +++ b/rclcpp/include/rclcpp/node.hpp @@ -47,9 +47,16 @@ class Executor; namespace node { -// TODO: add support for functors, std::function, lambdas and object members template -struct function_traits; +struct function_traits +{ + static constexpr std::size_t arity = + function_traits::arity - 1; + + template + using argument_type = + typename function_traits::template argument_type; +}; template struct function_traits @@ -64,6 +71,11 @@ template struct function_traits: public function_traits {}; +template +struct function_traits + : public function_traits +{}; + /* ROS Node Interface. * * This is the single point of entry for creating publishers and subscribers.