BOOST_UBLAS_INLINE
vector (vector &&v):
vector_container<self_type> ()
{ data_.swap(v.data());}
ublas::vector<double> doubleit(ublas::vector<double> &&m)
{
m*=2.0;
std::cout << "Temporary pointer: " << &m[0] << std::endl;
return std::move(m);
}
a = doubleit(doubleit(doubleit(doubleit(a))));
with absolutely no copy.The problem with bounded_... and c.. is that they allocate space into the stack, so swaping needs to actually copy their elements, hence nullifying the effects of move semantics. I think for the bounded_.... classes changing from ownership of the underlying container to a pointer to them (and necesseary changes in construction, destruction and swap), will do it (We can right? my mind is not looping here?). For the c_.... we will probably need to introduce boost::array. The important thing is to keep them into the stack.
Also, rvalue reference is not a cure for everything. Even with that, bounded_... and c_... will not be move semantics enabled. Although a first effect of c++0x rvalue references will be that we can enable prod(A,prod(B,prod(C,prod(D,F)))) without unnecesarry copies.