|
Boost : |
From: Andreas Pokorny (andreas.pokorny_at_[hidden])
Date: 2007-04-07 03:23:07
Hi,
I have looked at the examples and they all look very readable. I am now
missing a facility to make more extended checks.
I am not sure if I completly understood the syntax of the proto dsl.
Here is a small matrix-vector example:
struct RowVector
: proto::or_<
proto::terminal< row_vector<_> >
, proto::terminal< dyn_row_vector >
>{};
struct ColumnVector
: proto::or_<
proto::terminal< col_vector<_> >
, proto::terminal< dyn_col_vector >
>{};
struct MatrixExpr
: proto::or_<
proto::multiply<ColumnVector,RowVector>
>{};
struct ScalarExpr
: proto::or_<
proto::terminal< float>
, proto::multiply<RowVector,ColumnVector>
>{};
In this case col_vector and row_vector could be like boost_array, with
a compile time dimension, while dyn_col_vector and dyn_row_vector behave
more like std::vector.
Now I would like to forbid the mulitplication operator at compile time
if both dimensions are compile time ones, and do not match. In all other
cases the check has to be executed during runtime.
How can I do that with proto?
Regards
Andreas Pokorny
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk