#ifndef BOOST_LEAF_DETAIL_FUNCTION_TRAITS_HPP_INCLUDED #define BOOST_LEAF_DETAIL_FUNCTION_TRAITS_HPP_INCLUDED // Copyright (c) 2018-2020 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) #ifndef BOOST_LEAF_ENABLE_WARNINGS # if defined(__clang__) # pragma clang system_header # elif (__GNUC__*100+__GNUC_MINOR__>301) # pragma GCC system_header # elif defined(_MSC_VER) # pragma warning(push,1) # endif #endif #include #include namespace boost { namespace leaf { namespace leaf_detail { template struct gcc49_workaround //Thanks Glen Fernandes { using type = void; }; template using void_t = typename gcc49_workaround::type; template struct function_traits { constexpr static int arity = -1; }; template struct function_traits> { private: using tr = function_traits; 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 { 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 : function_traits { }; template struct function_traits : function_traits { }; template struct function_traits : function_traits { }; template struct function_traits : function_traits { }; template struct function_traits : function_traits { }; template struct function_traits : function_traits { }; template struct function_traits : function_traits { }; template struct function_traits : function_traits { }; 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