Unfortunately I'm unable to get the below suggestion to work. Could you please mention if this was what you were referring to: http://www.boost.org/doc/libs/1_49_0/libs/range/doc/html/range/reference/ada... If so, the closest file I have in my Boost Version 1.0 is boost/range/iterator_range.hpp but that doesn't have the below copy function. I'll probably need to get the 1.49.0 version then. Thanks, Vipin On Sat, 27 Oct 2012, Nathan Ridge wrote:
Alternatively, I can avoid the tmp variable altogether and get a working program to copy the result of matrix-vector multiplication onto a new vector y but then I would need two multiplications. E.g. <CODE> std::copy(prod(m,x).begin(), prod(m,x).end(), y.begin()); <CODE>
This doesn't answer your question, but I just wanted to point out that the above line is undefined behaviour, since the begin and end iterators refer to two different ranges (two different temporary variables). This problem can be avoided by using boost::copy (from Boost.Range) instead, which allows you to mention the range just once:
boost::copy(prod(m, x), y.begin());
Regards, Nate
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users