|
From: DU V. DE V. F. G. P. <fra...@ca...> - 2007-04-19 16:53:07
|
>Apart from adding operations to std::vector, the above is not as >efficient as Array:operator+. if you write >std::vector<Real> w =3D u+w; >the addition returns a Disposable, but the std::vector constructor >doesn't know what to do with it, so it copies its contents instead of >swapping. If you want full efficiency, you have to write: >std::vector<Real> w; >w.swap(u+v); >which is more awkward. On the other hand, Array defines a constructor >taking a Disposable, so there's no moving in >Array w =3D u+v; I badly missed this point, I will slap myself with bjarne's book ;-) Fran=E7ois |