要求模板变量为空的语法是什么?
有没有办法编写 requiresrequire
表达式来理解模板参数是否为空?
我相信将 std::is_void_v
是否可以?该怎么做呢?
Is there a way to write a requires requires
expression to apprehend that a template parameter is void?
I believe it is legal to make the value of std::is_void_v<ParmThree>
a parameter of the template. However, I cannot formulate a syntax to check this in a requirement - for being either true or false.
Is it possible? How would it be done?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
requires
有效,因为嵌套的(第二个)requires
返回一个 bool。由于您已经有了一个 bool,您只需执行
requires std::is_void_v
即可:requires requires
works because the nested (second)requires
returns a bool.Since you already have a bool, you can just do
requires std::is_void_v<T>
: