On 9/11/10 8:31 AM, alfC wrote:
On Sep 10, 4:36 pm, Joel de Guzman
wrote: On 9/11/10 4:37 AM, alfC wrote:
I noticed that in some contexts I have both the object class and the corresponding phoenix function
class impl; ...
impl f_impl; boost::phoenix::function<impl> f(f_impl);
now to avoid the copying I could use:
boost::phoenix::function
f(f_impl); which works. Although boost::phoenix::function
f(f_impl); //doesn't work. (error below) Is there any problem with using references at all, in the first place?
I'm not sure. Could you provide a minimal cpp file I can try?
Yes, see below. Althougth now that I made this example I realize that the underlying object implementation is copied many times anyway (at least 4 times in the example), I guess during the building up of the expression template. [The final objective was to make an object function that not only evaluates but also is able to take expression and build expression templates].
Here's my suggestion: write a proxy function object that holds the target function object by reference, pointer, or boost.ref and use that to wrap your phoenix function. HTH, Regards, -- Joel de Guzman http://www.boostpro.com http://spirit.sf.net