
Pavel Chikulaev wrote:
"Jonathan Turkanis" <technews@kangaroologic.com> wrote in message news:d0hups$587$1@sea.gmane.org...
I'd like a library which simplifies the implementation of expression templates. However, I'd like it to be more general than you have outlined.
More general? Plese tell me what you mean.
See my next comment.
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.
Okay, this certainly wan't clear from you're feature summary. I'll admit I didn't study the sample usage; this was because the feature summary seemed inadequate. Now that I look at your sample, I wonder whether it is possible to support operators which take instances of different types. This would be essential for an expression templates library.
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 possible,
Of course.
and macros is the only way (AFAIK) to achieve such simplicity.
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.
Have you considered the approach taken by Boost.Operators? http://www.boost.org/libs/utility/operators.htm Also, I believe Fusion (the sucessor to Tuple) would be a valuable tool. I'm not saying that macros have no place in an expression templates library; in the iostreams library, a single macro invocation is used to make a Filter usable with operator|. Jonathan