1 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
2 // vim: ts=8 sw=2 smarttab
5 * https://github.com/exclipy/inline_variant_visitor/blob/master/function_signature.hpp
6 * which apparently copied it from
7 * http://stackoverflow.com/questions/4771417/how-to-get-the-signature-of-a-c-bind-expression
10 #ifndef FUNCTION_SIGNATURE_H
11 #define FUNCTION_SIGNATURE_H
13 #include <boost/mpl/pop_front.hpp>
14 #include <boost/mpl/push_front.hpp>
15 #include <boost/function_types/function_type.hpp>
16 #include <boost/function_types/result_type.hpp>
17 #include <boost/function_types/parameter_types.hpp>
20 struct signature_of_member
22 typedef typename boost::function_types::result_type<F>::type result_type;
23 typedef typename boost::function_types::parameter_types<F>::type parameter_types;
24 typedef typename boost::mpl::pop_front<parameter_types>::type base;
25 typedef typename boost::mpl::push_front<base, result_type>::type L;
26 typedef typename boost::function_types::function_type<L>::type type;
29 template <typename F, bool is_class>
30 struct signature_of_impl
32 typedef typename boost::function_types::function_type<F>::type type;
36 struct signature_of_impl<F, true>
38 typedef typename signature_of_member<decltype(&F::operator())>::type type;
44 typedef typename signature_of_impl<F, boost::is_class<F>::value>::type type;