
AMDG Edward Grace wrote:
So, I have nearly figured out what to do, however it seems -- deliberately in fact, that the behaviour of result_of<???> is different when passed a function and a functor.
The type of a function pointer is unsigned(*)(). The return type is easily deducible from the type of the function pointer. For function objects, you need to use result_type or result, since it is impossible to deduce the result type automatically
<snip>
struct one_functor { // This is apparently needed if we want to use result_of<..> on nullary functors like this. // typedef unsigned result_type; unsigned operator()() { return 1; } };
In the current standard it is impossible to deduce the result without using the result_type typedef. In C++0x, result_of is specified using decltype, so it won't be necessary. In Christ, Steven Watanabe