What is the performance implication of converting to bool in C++?

前端 未结 11 855
后悔当初
后悔当初 2020-12-03 02:36

[This question is related to but not the same as this one.]

My compiler warns about implicitly converting or casting certain types to bool whereas explicit

11条回答
  •  爱一瞬间的悲伤
    2020-12-03 02:56

    Sounds like premature optimization to me. Are you expecting that the performance of the cast to seriously effect the performance of your app? Maybe if you are writing kernel code or device drivers but in most cases, they all should be ok.

提交回复
热议问题