
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. Example: class Vector;
"Jonathan Turkanis" <technews@kangaroologic.com> wrote in message news:d0i7jt$60a$1@sea.gmane.org... old class Matrix { static lazy::type<Vector> Vector_; //Actually there is no need to define it //It is possible to use LAZY_OP(lazy::type<Vector>() * lazy::type<Vector>()) //but defining static object AFAIK is the simpliest way. public: LAZY_OP(Matrix_ * Vector_); // Or Matrix_ * Vector_ I don't remember ENABLE_LAZY_OP(Matrix_ = Matrix_ * Vector_); }; //You can use all classes. Just wrap their types in lazy::type<> and use //LAZY_OP or ENABLE_LAZY_OP or ALIAS and so on. I'm predicting you're next question - Is templates supported? Yes. Example: template<typename T> class Matrix { static lazy::type<Matrix> Matrix_; template<typename U> struct Matrix__ : lazy::type<Matrix<U> > {}; public: template<typename U> LAZY_OP(Matrix_ + Matrix__<U>()); //A bit uglier, isn't it? };
Have you considered the approach taken by Boost.Operators? Not yet. I still don't know whether to make += lazy operator or code += operator as usual.
Also, I believe Fusion (the sucessor to Tuple) would be a valuable tool. Is it (same as)(old version of) Tuple?
-- Pavel Chikulaev