C++ についてもっと学ぼうとソース コードを調べていると、わかりにくいコードに出会いました。私はそれをいじってその用途を理解することができませんでした。
演算子 float *() の機能とその使用方法を誰かが説明できますか?
クラス ベクトル
{
公衆:
x、y、z をフロートします。
Vector() : x(0), y(0), z(0){
}
Vector( float x, float y, float z ) : x(x), y(y), z(z){
}
operator float*(){
return &x;
}
operator const float *(){
return &x;
}
I have searched StackOverflow and it looks like it is a conversion operator but I am still unsure what it actually does and why it is useful.
Kind regards,