I try to overload binary operators for a VectorWrapper but I don't manage to do it.
My wrapper looks like this :
========================================================
template<typename ScalarType>
class Vector
{
public:
typedef Eigen::Matrix<ScalarType,Eigen::Dynamic,1> VectorType;
private:
VectorType wrapped_;
};
========================================================
Don't worry about names, data structure, etc, or the necessity of wrapping such a thing: it is just an example to illustrate my problem.
So, I would like to overload binary operators for Vector class, for example the sum of two vectors.
It seems that the classical version:
========================================================
template<typename ScalarType>
Vector<ScalarType> operator+(Vector<ScalarType> const & lhs, Vector<ScalarType> const & rhs)
{ return lhs.wrapped_ + right.wrapped_; }
========================================================
does not work. I guess it is because an expression template is returned by operator + in Eigen.