может быть вызван с нуля аргументами?
https://www.boost.org/doc/libs/1_77_0/libs/type_traits/doc/html/boost_typetraits/reference/function_traits.html
Блин это конечно классно
Сорян если это не те трейты, я в одном своём проекте юзал откуда то с гита, там можно было проверить количество аргументов и их типы в любом Callable
> function_traits is intended to introspect only C++ functions of the form R (), R( A1 ), R ( A1, ... etc. ) and not function pointers or class member functions. To convert a function pointer type to a suitable type use remove_pointer.
https://www.boost.org/doc/libs/master/libs/callable_traits/doc/html/index.html
template<typename Class, typename Ret, typename ... Args> struct X<Ret(Class::*)(Args...) const/ const volatile/ noexcept> { }
О, круто что в бусте есть таки
Неужели noexcept прямо участвует в типе функции?
Да, это часть типа, но не сигнатуры.
“Don't try to write helper code to detect PMFs/PMDs and dispatch on them -- it is an absolute nightmare. PMF types are the worst types by far in the core language.” -- Stephan T. Lavavej, CppCon 2015, "functional: What's New, And Proper Usage"
согласен, но надо же иногда
Обсуждают сегодня