3 ms·
I wonder how many people would know about using return_type = typename std::result_of<F(Args...)>::type though.
by stabbles 7y ago
I wonder how many people would know about
using return_type = typename std::result_of<F(Args...)>::type
though.
- 0xffff2 7y agoIt's a neat trick I hadn't seen before, but it doesn't seem particularly advanced. There are all kinds of things in the STL that I don't remember or care about until I actually need them.
- knorker 7y agoMaybe in this context they shouldn't, either. using return_type = decltype(f(args...)); seems easier to read and "more C++11". Also the "> >" is a pre-C++11 pattern.
- JakobProgsch 7y agoEarlier versions did use decltype but that causes issues with pointers to member functions. See: https://github.com/progschj/ThreadPool/commit/ac2a77d5cc04361d341f63b1d19706a4d1b4943e https://github.com/progschj/ThreadPool/commit/ac2a77d5cc0436... result_of has now been deprecated in newer C++ versions but since this advertises itself as C++11 thread pool I intend to leave it as is.