
18 Sep
2007
18 Sep
'07
12:39 p.m.
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