I am developing a library where one of its public interface class defined as:
class speed:
public:
//constructors, operators, setter, getters...
private:
float x,y,z;
};
I think here that I am re-inventing the wheel again. Using something like Eigen::vector3f
(or any other alternative from another known 3rd libraries) instead of plain float x,y,z
as a private member variable is much superior than re-writing all arithmetics operators taking care of all corners case.
In the same time, I do not want to expose any 3rd party with my library (that is a requirement that I have to meet).
Would it be wise to forward declare the the Eigen::vector3f
or any other well-designed float vector and use it inside a suitable smart pointer?
To not trap in the opinion-based question style:
- Is there any possible risk by using this approach?
- Would it, theoretically, decrease the performance since the data is dynamically allocated?