On 8/26/2011 11:44 AM, Eric Niebler wrote: > Proto will > compute the domain of m*v to be matrix. It will use matrix_domain's > generator to post-process the new expression. That generator can do > anything -- including placing the new expression in the vector domain. > In short, there is no requirement that a domain's generator must produce > expressions in that domain. Just hack matrix_domain's generator.
Expanding on this a bit ... there doesn't seem to a sub-/super-domain relationship between matrix and vector. Why not make them both (together with covector) sub-domains of some abstract nt2_domain, which has all the logic for deciding which sub-domain a particular expression should be in based on its structure? Its generator could actually be a Proto algorithm, like: nt2_generator : proto::or_< proto::when< vector_grammar , proto::generator<vector_expr>(_)> proto::when< covector_grammar , proto::generator<covector_expr>(_)> proto::otherwise< proto::generator<matrix_expr>(_)> > {}; struct nt2_domain : proto::domain<nt2_generator> {}; Etc... -- Eric Niebler BoostPro Computing http://www.boostpro.com _______________________________________________ proto mailing list proto@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/proto