Boost logo

Boost Users :

From: speedsnaii speedsnaii_at_[hidden])
Date: 2003-02-13 08:48:35


A question on use of the matrix and vector classes:

Should I:

matrix<double> foo(const matrix<double> a)
{
matrix >double> r;
   ...
   return r;
}

or

void foo(matrix<double>& r, const matrix<double> a)
{
  ...
}

In other words: is it expensive to construct the temporary in case
one? As I understand, the class would need an underlying 'copy on
write' to be cheap, similar as strings do.

I tried, to answer this question from the documentation, but sorry I
did not get through.

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