From: Pavel Chikulaev (pavel.chikulaev_at_[hidden])
Date: 2005-03-07 12:13:33
"Jonathan Turkanis" <technews_at_[hidden]> wrote in message
> I'd like a library which simplifies the implementation of expression
> However, I'd like it to be more general than you have outlined.
More general? Plese tell me what you mean.
> For instance I
> might not want a + -b to be computed as a - b, but I'd like to have this
> as an
> option, and not just for this particular sequence of operations.
If you put LAZY_ALIAS(Matrix_ + -Matrix_ = Matrix_ - Matrix_) then
a + -b will be computed as a - b, else it won't.
Another examples of LAZY_ALIAS:
LAZY_ALIAS(- - Matrix_ = Matrix_);
//- - a will be computed as a.
LAZY_ALIAS(-Matrix_ + Matrix_ = Matrix._2 - Matrix._1);
//-a + b will be computed as b -a.
> Also, I don't think it needs to be so heavily macro-based.
The key feature of the library is to make library usage as simple as
and macros is the only way (AFAIK) to achieve such simplicity.
1) Matrix(LAZY_OP(Matrix_ + Matrix_)) or equal non-macro version
lazy::predefined_ops::binary_plus, Matrix> &)
2) Matrix(LAZY_OP(Matrix_ + Matrix_ * Matrix_)) or equal non-macro
lazy::binary_op <Matrix, lazy::predefined_ops::mutiply, Matrix>
LAZY_ENABLE_OP expands to about 20 lines of code.
So, do you really think it can be less macro-based and
more readable at the same time?
If you have any ideas who do it, please send me how to do it.
-- Pavel Chikulaev
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk