Boost logo

Boost :

From: Pavel Chikulaev (pavel.chikulaev_at_[hidden])
Date: 2005-03-08 08:05:38

"Tobias Schwinger" <tschwinger_at_[hidden]> wrote in message
> It can be difficult to add such specializations - depending on how your
> expression templates are implemented. It's just something to keep in mind.

template<typename T, int Rows, int Cols>
class matrix
    static lazy::type<matrix> matrix_;
    matrix(LAZY_OP(matrix_ + matrix_));

template<typename T, int Rows, int Cols>
matrix<T, Rows, Cols>::matrix(LAZY_OP(matrix_ + matrix_) op)

matrix<int, 4, 4>::matrix(LAZY_OP(matrix_ + matrix_) op)
    //Using SIMD instructions.

Enough easy?

> - There should be an implicit conversion sequence that allows to evaluate
> a lazy expression:
Already works.
    void fun(Matrix &);
    Matrix a, b, c;
    fun(a + b * c * (a + b)); //compiles just fine.

> It's nice when the cross product implementation can indicate by the
> paramter type of its signature that it needs an intermediate result
> (otherwise it would have to evalutate the expression explicitly or
> direction * std::sin(a*half) will be evaluated twice).

It won't be evaluated twice, AFAIK.

> - Do you know the Boost.Assign technique ?
> I use a similar approach to have a nice syntax for initialization and
> inlining that works within expressions:
I believe that this is not within coverage of my library. My library deals
lazy evaluation of functions and n-arity operators.
Maybe I misundersand something?

Pavel Chikulaev 

Boost list run by bdawes at, gregod at, cpdaniel at, john at