X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=blobdiff_plain;f=src%2Fceph%2Fsrc%2Fcommon%2Ffunction_signature.h;fp=src%2Fceph%2Fsrc%2Fcommon%2Ffunction_signature.h;h=6d2a34ee65e381163dfa518ce36b221eb5d93d1a;hb=812ff6ca9fcd3e629e49d4328905f33eee8ca3f5;hp=0000000000000000000000000000000000000000;hpb=15280273faafb77777eab341909a3f495cf248d9;p=stor4nfv.git diff --git a/src/ceph/src/common/function_signature.h b/src/ceph/src/common/function_signature.h new file mode 100644 index 0000000..6d2a34e --- /dev/null +++ b/src/ceph/src/common/function_signature.h @@ -0,0 +1,47 @@ +// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- +// vim: ts=8 sw=2 smarttab +/* + * Copied from: + * https://github.com/exclipy/inline_variant_visitor/blob/master/function_signature.hpp + * which apparently copied it from + * http://stackoverflow.com/questions/4771417/how-to-get-the-signature-of-a-c-bind-expression + */ + +#ifndef FUNCTION_SIGNATURE_H +#define FUNCTION_SIGNATURE_H + +#include +#include +#include +#include +#include + +template +struct signature_of_member +{ + typedef typename boost::function_types::result_type::type result_type; + typedef typename boost::function_types::parameter_types::type parameter_types; + typedef typename boost::mpl::pop_front::type base; + typedef typename boost::mpl::push_front::type L; + typedef typename boost::function_types::function_type::type type; +}; + +template +struct signature_of_impl +{ + typedef typename boost::function_types::function_type::type type; +}; + +template +struct signature_of_impl +{ + typedef typename signature_of_member::type type; +}; + +template +struct signature_of +{ + typedef typename signature_of_impl::value>::type type; +}; + +#endif