
On Sun, Jun 6, 2010 at 4:41 PM, Joel de Guzman <joel@boost-consulting.com> wrote:
Is there a reason why you are not using plain phoenix::function(s) for this?
good point, I am still phoenix-challenged I guess. I got driven by the "Composite" example in the manual. This is the alternative implementation using phoenix::function: namespace boost{namespace phoenix{ struct real_impl{ template <typename Arg> struct result{ typedef double type; //can be generalized }; template <typename Arg> typename result<Arg>::type operator()(Arg z) const{ return real(z); } }; function<real_impl> real_; // "real" as name doesn't work }} int main(){ std::complex<double> z(1.,2.); cout << real_(arg1)(z) <<endl; return 0; } which works. ...But there is a problem it seem that I can not call "real_" as "real", so the resulting syntax is degraded. (Either I have to call the phoenix::function real_ or put std::real in the operator()) It seems that the overload get confused. Is there a way to go around this? (my poorly written first version --with no phoenix::function-- at least didn't have this limitation) Thank you, Alfredo