I have created a custom variable length vector class Vec
with the following overloaded operators:
float& operator[](int i);
Vec& operator+=(Vec& rhs);
Vec operator+(Vec& rhs);
Vec& operator-=(Vec& rhs);
Vec operator-(Vec& rhs);
Vec& operator*=(float rhs);
Vec operator*(float rhs);
Vec& operator/=(float rhs);
Vec operator/(float rhs);
These overloads work fine individually and I get the correct results, but when I try to chain them I get compilation errors with template argument deduction/substitution failed
. Does anyone have any idea why?
This works:
Vec multiplier = d * time;
Vec collision = e + multiplier;
This fails:
Vec collision = e + (d * time);
e and d are of type Vec
, time is of type float