"structural binding" 的提案在哪里?

Where is the proposal on "structural binding"?

在下面C++ Going native video,
提到了一种称为 "structural binding" 的语言功能。

我曾经 这个概念是 "destructuring" (来自 javascript 背景)。

该功能将允许用户捕获多个 return 值,而无需使用 std::tie 或指定类型。

示例:

std::map<std::string,int> table;
auto { cursor, inserted } = table.insert({"hello",0});  

在哪里可以找到此提案并跟踪其进度?

您所指的提案是 P0144R0: Structured Bindings . The post-Kona mailing lists this paper as under Evolution Working Group. It is not covered in the current Evolution Working Group(EWG) active issue list,Nicol Bolos 指出 EWG 活动问题列表尚未针对 Kona 进行更新。一旦它出现在 EWG 活动列表中,您就可以通过跟踪问题来跟踪提案。

有一些非常好的旅行报告,特别是 Botond Ballo's trip report 鼓励进一步工作的提案 部分下涵盖了该提案,它说:

A proposal for de-structuring initialization, that would allow writing auto {x, y, z} = expr; where the type of expr was a tuple-like object, whose elements would be bound to the variables x, y, and z (which this construct declares). “Tuple-like objects” include std::tuple, std::pair, std::array, and aggregate structures. The proposal lacked a mechanism to adapt a non-aggregate user-defined type to be “tuple-like” and work with this syntax; EWG’s feedback was that such a mechanism is important. Moreover, EWG recommended that the proposal be expanded to allow (optionally) specifying types for x, y, and z, instead of having their types be deduced.

我们可以前往 WG21 site and going to the papers section.

找到 WG21 会议邮件

如T.C。注意还有一个竞争提案 P0151R0: Proposal of Multi-Declarators 说:

We propose a better approach for “Structured Bindings” as defined in P0144R0 where “better” is defined as terser, more ortogonal, more general, more expressive, less (parsingwise) ambiguous.