SFINAE replacement for std::result_of
The gnu C++11 implementation of std::result_of
does not contain the typedef type
for methods that return void. This does not comply with the SFINAE policy. Heres a simple replacement for the type trait that does work.
template<typename Expr>
class result_of;
template<typename F, typename... Args>
struct result_of<F(Args...)>
{
typedef decltype(std::declval<F>()(std::declval<Args>()...)) type;
};
Written by Miguel Ibero
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#C
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#