Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
C++17 function traits not works
#include <tuple> #include <functional> #include <type_traits> int f (); void g (int); void h (int, int); template <typename T> struct function_traits { template <typename R, typename ... As> static std::tuple<As...> pro_args (std::function<R(As...)>); using arguments = decltype(pro_args(std::function{std::declval<T>()})); }; int main () { static_assert(std::is_same_v<std::tuple<>, function_traits<decltype(f)>::arguments>); static_assert(std::is_same_v<std::tuple<int>, function_traits<decltype(g)>::arguments>); static_assert(std::is_same_v<std::tuple<int, int>, function_traits<decltype(h)>::arguments>); }
run
|
edit
|
history
|
help
0
my override
uniq ptr
How to test call member?
user defined exception
C++ does not have reference-to-reference types
Clang-IsBaseOf
Range List for C++
function returning a function demo
SubsequenceArray
Uno v2