15 #ifndef RCLCPP__FUNCTION_TRAITS_HPP_
16 #define RCLCPP__FUNCTION_TRAITS_HPP_
41 template<
typename Head,
typename ... Tail>
48 template<
typename FunctionT>
56 template<std::
size_t N>
63 template<
typename ReturnTypeT,
typename ... Args>
70 template<std::
size_t N>
77 template<
typename ReturnTypeT,
typename ... Args>
82 template<
typename ClassT,
typename ReturnTypeT,
typename ... Args,
typename ... FArgs>
83 #if defined _LIBCPP_VERSION // libc++ (Clang)
85 #elif defined _GLIBCXX_RELEASE // glibc++ (GNU C++ >= 7.1)
86 struct
function_traits<std::_Bind<ReturnTypeT(ClassT::*(FArgs ...))(Args ...)>>
87 #elif defined __GLIBCXX__ // glibc++ (GNU C++)
88 struct
function_traits<std::_Bind<std::_Mem_fn<ReturnTypeT (ClassT::*)(Args ...)>(FArgs ...)>>
89 #elif defined _MSC_VER // MS Visual Studio
91 std::_Binder<std::_Unforced, ReturnTypeT (ClassT::*)(Args ...), FArgs ...>>
93 #error "Unsupported C++ compiler / standard library"
99 template<
typename ClassT,
typename ReturnTypeT,
typename ... Args,
typename ... FArgs>
100 #if defined _LIBCPP_VERSION // libc++ (Clang)
101 struct function_traits<
std::__bind<ReturnTypeT (ClassT::*)(Args ...) const, FArgs ...>>
102 #elif defined _GLIBCXX_RELEASE // glibc++ (GNU C++ >= 7.1)
103 struct function_traits<std::_Bind<ReturnTypeT(ClassT::*(FArgs ...))(Args ...) const>>
104 #elif defined __GLIBCXX__ // glibc++ (GNU C++)
105 struct function_traits<std::_Bind<std::_Mem_fn<ReturnTypeT (ClassT::*)(Args ...) const>(FArgs ...)>>
106 #elif defined _MSC_VER // MS Visual Studio
107 struct function_traits<
108 std::_Binder<std::_Unforced, ReturnTypeT (ClassT::*)(Args ...) const, FArgs ...>>
110 #error "Unsupported C++ compiler / standard library"
112 : function_traits<ReturnTypeT(Args ...)>
116 template<
typename ReturnTypeT,
typename ... Args,
typename ... FArgs>
117 #if defined _LIBCPP_VERSION // libc++ (Clang)
118 struct function_traits<
std::__bind<ReturnTypeT( &)(Args ...), FArgs ...>>
119 #elif defined __GLIBCXX__ // glibc++ (GNU C++)
120 struct function_traits<std::_Bind<ReturnTypeT(*(FArgs ...))(Args ...)>>
121 #elif defined _MSC_VER // MS Visual Studio
122 struct function_traits<std::_Binder<std::_Unforced, ReturnTypeT( &)(Args ...), FArgs ...>>
124 #error "Unsupported C++ compiler / standard library"
126 : function_traits<ReturnTypeT(Args ...)>
130 template<
typename ClassT,
typename ReturnTypeT,
typename ... Args>
135 template<
typename FunctionT>
139 template<
typename FunctionT>
147 template<std::
size_t Arity,
typename FunctorT>
149 bool, (Arity == function_traits<FunctorT>::arity)> {};
151 template<
typename FunctorT,
typename ... Args>
153 typename function_traits<FunctorT>::arguments,
158 template<
typename FunctorAT,
typename FunctorBT>
160 typename function_traits<FunctorAT>::arguments,
161 typename function_traits<FunctorBT>::arguments
169 #endif // RCLCPP__FUNCTION_TRAITS_HPP_