
On Jul 1, 2007, at 6:24 PM, Eric Niebler wrote:
But now that I think about it some more, Dan probably wants if_ to be an actual function instead of a Proto terminal, because phoenix expressions have an operator() that does something special. You can use the BOOST_PROTO_DEFINE_FUNCTION_TEMPLATE macro for this.
BOOST_PROTO_DEFINE_FUNCTION_TEMPLATE( 1 , if_ , phoenix::phoenix_domain , (phoenix::tag::if_) , BOOST_PP_SEQ_NIL )
Eric, what is the meaning of the last argument (empty here and called BOUNDARGS in the sources)? The only example I could find is in mixed.cpp where it seems to be used to allow the tag to be unrelated to the function being defined. Following that example: BOOST_PROTO_DEFINE_FUNCTION_TEMPLATE( 1, if_, phoenix::phoenix_domain, proto::tag::function ((if_struct)) ) would also work and create a proto::expr with a tag::function as tag and first argument a (terminal?) if_struct. It assumes if_struct has a default constructor. Is this the right interpretation? In the mixed.cpp example is defining struct sin_ { } the way it is enough to allow the default_context to evaluate sin_(expr)?