Boost logo

Boost Users :

From: Michael Bradley Jr (mbradley.jr_at_[hidden])
Date: 2007-09-18 08:39:06


Hi,

I'm looking for a way to let the function object wrapper be stored by reference
instead of by cloning/copying.
It's said in [1] that someone can achieve this through the use of references,
but i don't know how to apply it in this particular case.

<code>
class A {
bool operator()(void) {return false;}
};

typedef boost::function<bool (void)> TEST;

class B {
void invoke(TEST obj);
};

When i pass an instance of A as a parameter to the invoke method of B then the
whole object is copied. I just want it to be use

</code>

I've also use boost::ref without success

class C {
void invoke(TEST & obj);
};
doesn't work either!

Thanks for any help or hint

Michael

[1] http://www.boost.org/doc/html/function/misc.html#id1215718


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