Boost logo

Proto :

Subject: [proto] Defining the result domain of a proto operator
From: Mathias Gaunard (mathias.gaunard_at_[hidden])
Date: 2011-08-26 10:25:10


With the following Proto expression:
m * v;

with m in the matrix_domain and v in the vector_domain.
vector_domain is a sub-domain of matrix_domain, so the common domain is
matrix_domain.

We want the '*' operation to model the matrix multiplication.
matrix times vector yields a vector.
Therefore, the result of m * v should be in the vector_domain.

If we define operator* ourselves, then we can easily put the domain we
want when calling proto::make_expr.

However, using Proto-provided operator overloads, this doesn't appear to
be possible.

Is there a mechanism in Proto to define how the domain of a node new
should be computed depending on the tag and the domains of the children?


Proto list run by eric at boostpro.com