Boost logo

Boost Users :

From: jhr.walter_at_[hidden]
Date: 2003-02-25 03:59:09


Hi Roland,

you wrote:

> I am trying to find a good choice for argument types to a function.
>
> (Please be patient, I am a poor user of C++ who has not yet
> understood all this expression template magic.)
>
> I'd like to have a function:
>
> void foo( whattype arg) {
> }
>
> matrix<double> m(3,3);
> vector<double> v(6);
>
> and call it like:
>
> foo(m.column(0));
> foo(m.row(0));
> foo(v);
>
> Is this feasible?

I'd tend to use

template<class E>
void foo (vector_expression<E> &arg);

or

template<class E>
void foo (const vector_expression<E> &arg);

> Should I use iterators for whattype?

Unsure about that.

> (how do I
> access size information then?)

it ().size ();

> Am I trying to misuse the ublas when
> asking such a question?

Nope.

> (Which container should I use in this case?)

No need to copy yet.

> In the hope anyone can shade some light on it.

HTH,

Joerg


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net