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
Initialise arrays with N number
AnnotateAttr templated test
Random values and probability distribution
Template Meta Programming
sfinae
Throttle Example in C++
simple in-memory b-tree
Struct memory ordering
Deleted special operations are propagated to derived class
radixSort