Boost logo

Boost :

From: Martin Bosticky (mbosticky_at_[hidden])
Date: 2002-10-30 11:59:50


Hello boosters

I am passing a whole group of parameters to a function and then i construct
an object with exactly the same parameters passed into the constructor.

ie.
void MyFunction(const int& x, const AClass& y)
{
    SpecialObject anObject(const int& x, const AClass& y);

    return anObject.run();
}

I am doing this a lot and with different combinations and numbers of
parameter. I am wondering if there is a clever way to do this so i can save
my self some typing. This is a simple example but in practice I could be
passing say 5 parameters in.

My first attempt was to declare the class within the function and hoping
that the run() function of the class would have access to the passed
parameters as if they were globals or something. Unfortunately i could not
get this to work.

If there was a clever solution then perhaps it could become part of boost
library.

Any suggestions appreciated, Martin.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk