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
hw1 Os
Narrowing error
regimeketopdf
Recursive Call Example Sum
pointer to complete array does not convert implicitly to pointer to array of unknown bound
Erase a std::unordered_map::local_iterator by key
Throttle Example using a circular queue (Push all but 2 less than maxSize; then pop all but 2 of current size)
Deleted special operations are propagated to derived class
C++ Register
overloading