【发布时间】:2012-09-01 02:01:31
【问题描述】:
不同于平常
void foo (void ) {
cout << "Meaning of life: " << 42 << endl;
}
C++11allows 是另一种选择,使用尾随返回
auto bar (void) -> void {
cout << "More meaning: " << 43 << endl;
}
在后者中 - auto 旨在代表什么?
另一个例子,考虑函数
auto func (int i) -> int (*)[10] {
}
同样的问题,这个例子中auto是什么意思?
【问题讨论】:
-
必须阅读这个 - 但我猜什么 - 你没有返回任何东西;-)
-
请重新阅读问题。
void当然的返回类型,在这种情况下auto是什么意思 -
第二次得到它错过了->void