Is the operation “false < true” well defined?

后端 未结 4 727
孤城傲影
孤城傲影 2020-12-24 11:40

Does the C++ specification define:

  1. the existence of the \'less than\' operator for boolean parameters, and if so,
  2. the result of the 4 parameter permut
4条回答
  •  無奈伤痛
    2020-12-24 12:04

    Boolean false is equivalent to int 0, and boolean true is equivalent to int 1. So this explains why the expression false < true => 0 < 1 is the only one which returns true.

提交回复
热议问题