Boost logo

Ublas :

Subject: [ublas] pass by reference for vector(_proxy)
From: Klaas Vantournhout (K.Vantournhout_at_[hidden])
Date: 2010-03-25 12:17:36


Hi all,

I recently started to use uBlas and I could not figure the following out.

If you want to pass a vector or vector_proxy as a reference to a function,
how do you do this so that the data is not coppied?

The function

void foo(const vector<double> &v) {
}

makes a pure reference to any pure vector<double> passed to the function,
however when passing a vector_proxy to it, it starts to copy the data.

Is there a way to avoid this?

Regards

-- 
ZAPHOD	Hey, this rock...
FORD	Marble...
ZAPHOD	Marble...
FORD	Ice-covered marble...
ZAPHOD	Right... it's as slippery as... as... What's the slipperiest
 	thing you can think of?
FORD	At the moment? This marble.
ZAPHOD	Right. This marble is as slippery as this marble.
- Zaphod and Ford trying to get a grip on things in Brontitall, Fit the Tenth.