Compiler error with QuantityVector
I am performing a calculation whose outcome is a QuantityVector. Then, I want to store the result (let's call the result X) in 2 std::vectors (let's call the vectors V1 and V2).
So basically, having calculated X I want to do the following:
V1.at(i) = X; V2.at(i) = - X;
V2.at(i) = - X; does not work and it gives the following compiler error:
/corsika/corsika/detail/framework/geometry/QuantityVector.inl:132:52: error: cannot bind non-const lvalue reference of type 'corsika::QuantityVector<phys::units::dimensions<1, 1, -3, -1> >&' to an rvalue of type 'corsika::QuantityVector<phys::units::dimensions<1, 1, -3, -1> >' 132 | return QuantityVector<TDimension>(-eigenVector_); | ^
This compiler error goes away if in QuantityVector.hpp and QuantityVector.inl I change
auto& operator-() const to
auto operator-() const.
So, by losing the reference that works. Does this seem sensible to you?