为什么void {}不存在? [英] Why doesn't void{} exist?
本文介绍了为什么void {}不存在?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想知道为什么 void()
是 void
但 void { }
不存在...?请参阅以下答案: https://stackoverflow.com/a/37708167/293195
I am wondering why void()
is a prvalue of void
but void{}
does not exist...? See the following answer: https://stackoverflow.com/a/37708167/293195
例如,在上下文中:
For example in the context:
template<typename R>
R foo(){
return R{};
}
推荐答案
CWG 2351 已使 void {}
合法。
这篇关于为什么void {}不存在?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文