What's the best way to force the user of a C++ function to acknowledge the semantic meaning of parameters that are numerical constants?

后端 未结 7 2192
故里飘歌
故里飘歌 2021-02-13 15:27

I\'d like to write function interfaces that force the user to acknowledge the semantic meaning of built-in constants. For example, I\'d like to take

void rotate(         


        
7条回答
  •  天命终不由人
    2021-02-13 15:38

    It does not need to be slower.

    The Ogre3d library have a Radian class. The assembly generated is exactly the same as that of using a float directly(atleast when I last tested under gcc with optimization enabled)

提交回复
热议问题