-
Avoid casts whenever practical, especially dynamic_casts in performance-sensitive code. If a design requires casting, try to develop a cast-free alternative.
-
When casting is necessary, try to hide it inside a function. Clients can then call the function instead of putting casts in their own code.
-
Prefer C++-style casts to old-style casts. They are easier to see, and they are more specific about what they do.
Item 27: Minimize casting.(Effective C++)
转载本文章为转载内容,我们尊重原作者对文章享有的著作权。如有内容错误或侵权问题,欢迎原作者联系我们进行内容更正或删除文章。
提问和评论都可以,用心的回复会被更多人看到
评论
发布评论
相关文章
-
51c自动驾驶~合集27
自动驾驶
自动驾驶