是(或将)使用熟悉的模板语法在lambda表达式允许? [英] Is (or will be) the use of familiar template syntax in lambda expressions allowed?

查看:134
本文介绍了是(或将)使用熟悉的模板语法在lambda表达式允许?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

C ++ 14介绍了通用lambdas。在浏览相关提案时,我发现 N3418 Faisal Vali,Herb Sutter和Dave Abrahams
其中2.2节标题为:

C++14 introduced generic lambdas. While skimming through the related proposals I found N3418 by Faisal Vali, Herb Sutter and Dave Abrahams. Therein section 2.2 is titled :


2.2允许在lambda表达式中使用熟悉的模板语法

2.2 Allow the use of familiar template syntax in lambda expressions

,并且以下代码示例包括类似这样的代码段。

and the following code examples include snippets like this one

[]<int N>(int (&a)[N]) {}

这样的事情无法编译(使用gcc,clang和Visual Studio),会出现一些问题:

Since such things fail to compile (with gcc, clang and Visual Studio), some questions come up :


  • 这是一个实现问题吗?

  • 阻止这部分被接受的原因是什么?

  • 最终将通用lambdas带入语言的提议是什么?

推荐答案

接受的论文版本为 N3649 ,我们可以转到Evolution工作组( EWG 完成问题16:N3649,N3560,N3559,N3418通用(多态)Lambda表达式的建议

The version of the paper that was accepted was N3649, we can see this by going to Evolution Working Group(EWG) Completed Issue 16: N3649, N3560, N3559, N3418 Proposal for Generic (Polymorphic) Lambda Expressions:


由波特兰2012年的EWG审核,继续撰写后续文件。

Reviewed by EWG in Portland 2012, proceeding with a follow-up paper.

已接受工作草案

布里斯托尔2013:不要在N3560中重新开放建议2.1和2.2,他们是
考虑NAD。

Bristol 2013: Do not re-open proposals 2.1 and 2.2 in N3560, they are considered NAD. The proposals 2.3 and 2.4 are covered by N3649.

请注意此参考建议 2.1 2.2 为NAD(不是缺陷),并且不会重新打开。 已从 N3418 分割出来,这是主要提案和建议 2.1 N3560 是:

Note this references proposal 2.1 and 2.2 as being NAD(Not A Defect) and that they won't be reopened. N3560 was split off from N3418 which was the main proposal and proposal 2.1 in N3560 was:


允许使用熟悉的模板语法lambda表达式

Allow the use of familiar template syntax in lambda expressions

纸张提案 2.1 被认为有争议:

that paper notes proposal 2.1 was considered controversial:


我们承认,支持完整的模板参数列表特征
被认为是有争议的(波特兰2012年的草根调查结果
:7 SF,5 F,3 N,1 A,1 SA 1),并且
因此结束本小节,并附上一个委员会的一些报价
成员不在场在EWG讨论
这个功能在波特兰的房间。

We admit that supporting the full template parameter list feature has been deemed controversial (the Portland 2012 straw-poll outcomes were: 7 SF, 5 F, 3 N, 1 A, 1 SA 1 ) by a few committee members, and therefore conclude this sub-section with some quotes from a committee member who was not present in the room during EWG's discussion of this feature in Portland.

,我们可以看到 N3649 不包含此提案我想从纸上的报价 N3560

and we can see that N3649 does not contain this proposal my guess from the quote in paper N3560:



我想我们需要的不仅仅是
汽车。我不知道还有多少,但我认为只有汽车会限制

" I think we need more than just auto. I'm not sure how much more, but I think having just auto would be too limiting ".

被认为是足够的,这与提议是 NAD 意味着它试图解决的问题不是真正的问题。

was that auto was considered sufficient in the end which would be consistent with saying that the proposal is NAD meaning the issue it attempted to resolve is not really an issue.

这篇关于是(或将)使用熟悉的模板语法在lambda表达式允许?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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