|
Boost Users : |
From: Fernando Cacciola (yg-boost-users_at_[hidden])
Date: 2003-08-07 09:26:42
Short question:
As the Subject says,
given a boost::function{1..N}<>,
how can I extract a tuple of all its arguments?
Long question:
Anyway, what I'm really trying to do is this:
Given some classes with different methods:
struct X { void f(int n ) ; } ;
struct Y { void g(char c, double d ) ; } ;
I want to easly create _polymorphic_ closures binding member functions of X /Y with instances of
X/Y and function arguments.
The goal is the have a deferred 'action' list for easy backtracing of an algorithm.
That is, instead of directly calling:
X x ;
Y y ;
x.f(1);
y.g('a',1.2);
I want to do something that would look like:
X x;
Y y;
ActionList actions;
actions.push_back( make_closure(&X::f, x,1) );
actions.push_back( make_closure(&Y::g, y,'a',1.2) );
std::for_each(actions.begin(),actions.end(),execute_action());
TIA
Fernando Cacciola
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