为什么void {}不存在? [英] Why doesn't void{} exist?

查看:95
本文介绍了为什么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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆