Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <tuple>
- template<class T>
- struct callable_trait
- {};
- template<class R, class... Args>
- struct callable_trait<R(Args...)>
- {
- using return_type = R;
- using argument_types = std::tuple<Args...>;
- };
- template<auto callable>
- using return_type = typename callable_trait<decltype(callable)>::return_type;
- void f();
- void g(return_type<f>);
- error: no type named 'return_type' in 'callable_trait<void (*)()>'
- using return_type = typename callable_trait<decltype(callable)>::return_type;
- ^~~~~
- auto lambda= [](){};
- void h(return_type<lambda>);
- error: a non-type template parameter cannot have type '(lambda at <source>:19:14)'
- void h(return_type<lambda>);
- ^
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement