Je veux être en mesure d'utiliser les fonctions mathématiques sur mes "Vector3D" s comme siComment autoriser mon Typedef Struct à Ajouter, Soustraire, Multiplier et Diviser?
vector3D a = v3d(1.0,1.0,1.0);
vector3D b = v3d(2.0,0.0,5.0);
a+=b;
vector3D c = a*b;
Le code pour mon struct typedef:
typedef struct _vector3D{
float x;
float y;
float z;
}vector3D;
static inline vector3D
v3d(const float x, const float y, const float z)
{
vector3D v = {x,y,z};
return v;
}
Comment puis-je permettre à mon struct typedef Vector3D gérer ces opérateurs?