X f()是什么意思? [英] What does X f() mean?
本文介绍了X f()是什么意思?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我看到了这段代码,但我不明白它的含义。
我知道我们如何使用默认构造函数,但这不是默认构造函数。这是什么?
I see this code and I can't understand what it mean. I know how we use default constructor but this is not default constructor. What is this?
class X
{
...
};
int main()
{
X f();
}
推荐答案
它声明一个函数 f
不带任何参数并返回类型 X
。
这也称为 最令人讨厌的解析器 。它是C ++标准定义声明的解释规则的方式的副产品。
It declares a function f
which takes no parameters and returns a type X
.
This is also known as Most Vexing Parse in C++. It is a byproduct of the way the C++ standard defines the interpretation rules for declarations.
这篇关于X f()是什么意思?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文