Skip to content

Vector::operator+()

Nicolas Marsic requested to merge VectorPlus into master

Last but not least :)!

I also need to compute the sum of Vectors, so I added a operator+.

By the way, do I understand correctly that the purpose of Vector::getEigen() is to return a copy of the Vector?

In addition, would it make sense to have allow 'proxy' Vector, i.e. a Vector that does not own its _vector, which would then be somewhere else and given at construction. Here's a little example of what I mean:

std::vector<> mydata(...);
algebra::Vector<> proxy(mydata, true); // Say true = proxy and false = copy
mydata[0] = 42; // Now proxy[0] = 42 as well
proxy[42] = 0;  // Now mydata[42] = 0 as well

IMO, this could be done by changing the _vector into a pointer and by having a owner flag.

What do you think? Is there perhaps a way I didn't see with the current API?

Cheers, Nicolas.

Merge request reports

Loading