1 // Copyright 2015-2018 Hans Dembinski 2 // 3 // Distributed under the Boost Software License, Version 1.0. 4 // (See accompanying file LICENSE_1_0.txt 5 // or copy at http://www.boost.org/LICENSE_1_0.txt) 6 7 #ifndef BOOST_HISTOGRAM_DETAIL_ARGS_TYPE_HPP 8 #define BOOST_HISTOGRAM_DETAIL_ARGS_TYPE_HPP 9 10 #include <tuple> 11 12 namespace boost { 13 namespace histogram { 14 namespace detail { 15 16 template <class T> 17 struct args_type_impl { 18 using T::ERROR_this_should_never_be_instantiated_please_write_an_issue; 19 }; 20 21 template <class R, class T, class... Ts> 22 struct args_type_impl<R (T::*)(Ts...)> { 23 using type = std::tuple<Ts...>; 24 }; 25 26 template <class R, class T, class... Ts> 27 struct args_type_impl<R (T ::*)(Ts...) const> { 28 using type = std::tuple<Ts...>; 29 }; 30 31 template <class R, class... Ts> 32 struct args_type_impl<R (*)(Ts...)> { 33 using type = std::tuple<Ts...>; 34 }; 35 36 #if __cpp_noexcept_function_type >= 201510 37 template <class R, class T, class... Ts> 38 struct args_type_impl<R (T::*)(Ts...) noexcept> { 39 using type = std::tuple<Ts...>; 40 }; 41 42 template <class R, class T, class... Ts> 43 struct args_type_impl<R (T ::*)(Ts...) const noexcept> { 44 using type = std::tuple<Ts...>; 45 }; 46 47 template <class R, class... Ts> 48 struct args_type_impl<R (*)(Ts...) noexcept> { 49 using type = std::tuple<Ts...>; 50 }; 51 #endif 52 53 template <class FunctionPointer> 54 using args_type = typename args_type_impl<FunctionPointer>::type; 55 56 template <class T, std::size_t N = 0> 57 using arg_type = std::tuple_element_t<N, args_type<T>>; 58 59 } // namespace detail 60 } // namespace histogram 61 } // namespace boost 62 63 #endif 64