Boost logo

Boost Users :

From: Toon Knapen (toon.knapen_at_[hidden])
Date: 2003-02-13 10:58:59


On Thursday 13 February 2003 14:48, "speedsnaii wrote:
> A question on use of the matrix and vector classes:
> 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.
>
matrices and vectors (the containers themselves) have deep copy semantics.
Views (like matrix_range, matrix_stride, matrix_row etc) have shallow copy semantics.

So if you want to pass a matrix by value (syntacticly) but want shallow copy semantics,
just define a matrix_range on your matrix that covers the whole matrix and use this
in the argument list.

toon


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