Boost logo

Boost Users :

From: speedsnaii speedsnaii_at_[hidden])
Date: 2003-03-04 15:28:01


Hi,

*) First question:

I am trying to get a reference to data of a container in the
following way:

matrix<double> m(3,3);
vector<double>& v(m.column(2));

But this seems not to be possible.

Is there a way to achieve this behaviour?

What I basically want to achive is having functor object that holds a
reference to a row/column of my container matrix.

>From my questions about argument types I know that m.column(2) is a
kind of
an expression. How can I get the underlying reference to data if
there even
is one?

*) Second question:

matrix<double> m(10,3);

... fill the matrix ...

matrix<double>::iterator it; // wrong this does not work!!

for (it = m.column(2).begin(); it != m.colum(2).end(); ++it) {
    cout << *it << " " << foo(*it) << endl;
}

How would I declare my iterator? I understand when I use
std::library-algorithms the automatic template parameter defer will
give me
the correct type from begin(). But in my case how should I declare the
iterator?

Thank you for help.

Roland


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