#ifndef BOOST_LEAF_DETAIL_FUNCTION_TRAITS_HPP_INCLUDED #define BOOST_LEAF_DETAIL_FUNCTION_TRAITS_HPP_INCLUDED // Copyright 2018-2022 Emil Dotchevski and Reverge Studios, Inc. // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) #include #include namespace boost { namespace leaf { namespace leaf_detail { template struct remove_noexcept { using type = T; }; template struct remove_noexcept { using type = R(*)(A...); }; template struct remove_noexcept { using type = R(C::*)(A...); }; template struct remove_noexcept { using type = R(C::*)(A...) const; }; template struct gcc49_workaround //Thanks Glen Fernandes { using type = void; }; template using void_t = typename gcc49_workaround::type; template struct function_traits_impl { constexpr static int arity = -1; }; template struct function_traits_impl> { private: using tr = function_traits_impl::type>; public: using return_type = typename tr::return_type; static constexpr int arity = tr::arity - 1; using mp_args = typename leaf_detail_mp11::mp_rest; template struct arg: tr::template arg { }; }; template struct function_traits_impl { using return_type = R; static constexpr int arity = sizeof...(A); using mp_args = leaf_detail_mp11::mp_list; template struct arg { static_assert(I < arity, "I out of range"); using type = typename std::tuple_element>::type; }; }; template struct function_traits_impl : function_traits_impl { }; template struct function_traits_impl : function_traits_impl { }; template struct function_traits_impl : function_traits_impl { }; template struct function_traits_impl : function_traits_impl { }; template struct function_traits_impl : function_traits_impl { }; template struct function_traits_impl : function_traits_impl { }; template struct function_traits_impl : function_traits_impl { }; template struct function_traits_impl : function_traits_impl { }; template struct function_traits: function_traits_impl::type> { }; template using fn_return_type = typename function_traits::return_type; template using fn_arg_type = typename function_traits::template arg::type; template using fn_mp_args = typename function_traits::mp_args; } } } #endif