Using std::result_of requires you to specify the function argument types. Which is not very practical when you don’t know the function signature. Happily @potatoswatter (David Krauss) over at Stack Overflow pointed out to me that std::function provides the desired functionality:
template< class Func >
struct ResultOf
{
typedef typename std::function<
typename std::remove_pointer<Func>::type
>::result_type T;
};
Mainly, this saves one from writing a large number of partial specializations for Visual C++ 10.0, which lacks support for C++11 variadic templates.
– Enjoy!
Advertisements
this is very nice post…thanks for giving this post….