Hi my friends.
At first i specify that i use C++11.
Often i need to make some operations before and after a call to a function. This function not have each time a same number of parameters, but one of the parameters i will change in a previous operation. It is possible to pass this central function to another function which will do automatically a previous operations, then call this passed function with parameters, and then after do some other operations ?
I read some useful information in page :
http://stackoverflow.com/questions/3377828/variadic-templates-for-lambda-expressions
but i am still not very clear what i need to make in my case.
Now, i will show how exactly happen in my code :
In one place i have :
1 2 3 4
|
auto biggerI = upper_bound(comb.begin(),comb.end(),pi);
auto piI = comb.insert(biggerI,pi);
bool testLess = test(possLess,comb,compsNr+1,compsMaxLess);
comb.erase(piI);
|
In another place i have :
1 2 3 4
|
auto biggerI = upper_bound(comb.begin(),comb.end(),pi);
auto piI = comb.insert(biggerI,pi);
writePis();
comb.erase(piI);
|
In another place i have :
1 2 3 4
|
auto biggerI = upper_bound(comb.begin(),comb.end(),pi);
auto piI = comb.insert(biggerI,pi);
getMaxim(length+1);
comb.erase(piI);
|
Our understand what i mean ?
I want to make a function that accept a function with differents parameters and do some operations, and call it with :
|
doSomeOperationsAround(function_with_parameters);
|
thanks for any help, Daniel