From 923ba6b7453203a4d604ce44b5d2a2828a2c90ea Mon Sep 17 00:00:00 2001 From: Danny Robson Date: Sat, 3 Mar 2018 13:41:35 +1100 Subject: [PATCH] types/traits: add dedicated function argument counting trait --- types/traits.hpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/types/traits.hpp b/types/traits.hpp index 265521c2..73e20c24 100644 --- a/types/traits.hpp +++ b/types/traits.hpp @@ -257,6 +257,21 @@ struct func_traits : public ::detail::func_traits< }; +/////////////////////////////////////////////////////////////////////////////// +template +struct function_argument_count : public std::integral_constant< + size_t, + std::tuple_size_v< + typename func_traits::argument_types + > +> { }; + + +//----------------------------------------------------------------------------- +template +constexpr auto function_argument_count_v = function_argument_count::value; + + /////////////////////////////////////////////////////////////////////////////// template