The adaptor future_ptr_fun is used to convert an ordinary N-ary function pointer to a future function object as described above. It is defined as follows:
template <class Arg1, class Arg2, , class ArgN,class Result>
future_pointer_to_N-ary_function<
Arg1, Arg2, , ArgN, Result>
future_ptr_fun(Result (*x)(Arg1, Arg2, ,
ArgN))
{
return future_pointer_to_N-ary_function<
Arg1, Arg2, , ArgN, Result>(x);
}
This template function also is parameterized on N+1 parameters - N argument types and one result type. The function itself takes one argument which is an N-ary function pointer, builds a future_pointer_to_N-ary_function object (passing this function pointer to its constructor), and returns this object. Figure 1 shows how this adaptor behaves.
Figure 1: The Future adaptor function
template behavior: It takes a function pointer for an N-ary function
and returns a future N-ary function object.