-
除了代码中给出的 |
Beta Was this translation helpful? Give feedback.
Answered by
Mq-b
May 21, 2024
Replies: 2 comments
-
数组类型隐式转换为指针的优先级比常规隐式转换的高的多: #include <iostream>
auto f(const auto&){
puts("1");
}
auto f(const int&){
puts("2");
}
int main(){
double a{};
f(a);
} 这段代码必然输出 数组的事没什么办法。 |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
Mq-b
-
见 CWG1789。如果 CWG1789 被接受并实现,则这个例子应该会调用数组版本的重载。 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
数组类型隐式转换为指针的优先级比常规隐式转换的高的多:
这段代码必然输出
1
。https://godbolt.org/z/eME1PPY3n数组的事没什么办法。