Boost logo

Boost :

Subject: Re: [boost] different matrix library?
From: DE (satan66613_at_[hidden])
Date: 2009-08-17 12:49:24


on 17.08.2009 at 20:28
 joel wrote :
> What if you need a function that, this need, need to pass an expression
> which is statically allocated or with any other policies on ?

    template<typename expression_type>
    void foo(const matrix_expression<expression_type> &m);
                 //^^this type of expression is the least restrictive
it's trivial

> You can't decently generate the combinatorial nbr of expression class
> this way ?

why not?

    matrix<double> m(3, 3); //dynamically allocated
    matrix<double, 3, 3> static_m; //statically allocated

it's just an example
what else? shape? define appropriate types (using CRTP of course!)

again, my point is: since you need to implement policies themselves
somewhere and their relationship and behavor (possibly by specializing
some templates) why not to do that by defining distinct types with
proper interfaces?
it's a very simple, stable, scalable, easily maintainable design
and more: it is easier to understand for users
oh and it works also

-- 
Pavel

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk