Hi all,
I am wanting to extend actors to access a member variable from the class. In the
examples they show extending an acotr by using a lazy function to call the function.
I was thinking I could use a lazy function to access the member, something like this:
template <typename Expr>
struct point_actor
: actor<Expr>
{
typedef actor<Expr> base_type;
typedef point_actor<Expr> that_type;
point_actor( base_type const& base )
: base_type( base ) {}
typename expression::function::type x;
typename expression::function::type y;
};
Where x_impl and y_impl are lazy functions that access the x and y variable.
Would this work as member variables, rather than member functions? Also,
why wouldnt the second parameter to expression::function take just actor
instead of just point_actor<Expr>? Does that make sense? The reason I ask is I would like to
control the actor that is returned and do something like this(using the above actor):
template <typename Expr>
struct rect_actor
: actor<Expr>
{
typedef actor<Expr> base_type;
typedef rect_actor<Expr> that_type;
rect_actor( base_type const& base )
: base_type( base ) {}
typename expression::function::type top;
typename expression::function::type bottom;
};
expression::terminal, rect_actor > arg1;
(cout << arg1.top.x)(my_rect());
Does that make sense? I can't seem to find any reference on the predefined
expressions, and I also can't find the header file for expression::function.
Finally, the is_actor trait doesn't seem work for extended actors.Is there a
workaround for that?
Thanks,
Paul