Boost logo

Boost Users :

From: Maik Beckmann (maikbeckmann_at_[hidden])
Date: 2007-11-29 14:23:50


Am Donnerstag 29 November 2007 20:05:20 schrieb Sohail Somani:
> On Thu, 29 Nov 2007 19:54:35 +0100, Maik Beckmann wrote:
> > PLEASE don't use ublas matrices as pointers! They are not made for this
> > (no virtual destructors for performace reasons). If you want to avoid
> > copying, allways use references.
>
> I hope you weren't suggesting to do this:
>
> // probably won't even compile, and will
> // hurt you if it does.
> vector_slice<T> & s = subslice(...);

A slice is a lightweight object, copying doesn't hurt.

No, the hint isn't related to slices and ranges. It's just:

typedef boost::numeric::ublas::matrix<double> matrix_type;
matrix_type At;
// .... fill At ...
matrix_type& cfo = mx;

vs.

matrix_type* cfo = &mx;


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