14.6.3 Logical negation operator

本文介绍了C++中逻辑非运算符!的基本用法及其类型转换规则。对于形式为!x的操作,将应用一元运算符重载解析来选择特定的运算符实现。操作数将被转换为所选运算符的参数类型,而结果的类型则是该运算符的返回类型。预定义的逻辑非运算符只有一个:bool operator!(bool x),该运算符计算操作数的逻辑否定。
For an operation of the form !x, unary operator overload resolution (?4.2.3)
is applied to select a specific
operator implementation. The operand is converted to the parameter type of
the selected operator, and the
type of the result is the return type of the operator. Only one predefined
logical negation operator exists:
bool operator !(bool x);
This operator computes the logical negation of the operand: If the operand
is true, the result is false. If
the operand is false, the result is true.
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值