|
Boost Users : |
From: vivek_arora (vivek_arora_at_[hidden])
Date: 2003-07-28 14:18:53
I am looking for pointers on how to use boost to implement a set of
template classes/helper functions which can be used for deferred
function/method call forwarding.
Here's an example of illustrating what I wish to accomplish.
I can live with restictions on the function argument types.
//Define a template type which can capture arguments of any (or
most) functions. I believe boost tuple could suit my requirements.
//Define a template helper function save_args which constructs a
arguments tuple based on the signature of the function passed
as the first argument.
e.g .
R f(T1, T2, T3);
boost:tuple<R, T1, T2, T3> args = save_args(f, t1, t2, t3);
//Don't want to explicitly specify types like save_args<R,T1,T2,T3>
(t1,t2,t3)
//Define another template helper function call_with_args which given
another function "g" with a signature conforming with "f" and the
argument tuple invokes "g"
e.g.
R g(T1, T2, T3)
//This should call g(args.get<0>, args.get<1>, args.get<2>)
call_with_args(g, args);
Could someone provide ideas, pointers/sample code for implementing
save_args, call_with_args helper template functions.
Thanks
-Vivek Arora
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net