gpt4 book ai didi

c++ - 为输入流选择重载的 void* 运算符

转载 作者:行者123 更新时间:2023-11-30 05:48:58 24 4
gpt4 key购买 nike

当编译器看到类似的东西时,如何选择输入流的重载 void* 转换运算符

int a;
while(cin >> a) {
}

最佳答案

来自 here

1) Returns a null pointer if fail() returns true, otherwise returns a non-null pointer. This pointer is implicitly convertible to bool and may be used in boolean contexts.

n3376 4.12/1

A prvalue of arithmetic, unscoped enumeration, pointer, or pointer to member type can be converted to a prvalue of type bool. A zero value, null pointer value, or null member pointer value is converted to false; any other value is converted to true.

关于c++ - 为输入流选择重载的 void* 运算符,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27960247/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com