什么是自动包围列表语法? [英] What is the auto Bracketed List Syntax?

查看:121
本文介绍了什么是自动包围列表语法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

WF 为我的问题在此处使用行的

auto [x, y] = div_t{ 1, 0 };

从答案中的代码看起来像是领带用于 div_t 结构。我希望有人可以解释这里发生的事情。完整的功能代码如下:

From the code in the answer it looks like that's like a tie for the div_t struct. I was hoping that someone could explain what was going on here. The complete function code was as follows:

constexpr bool first_quot() {
    auto [x, y] = std::div_t{1, 0};
    (void)y;
    return x;
}


推荐答案

= http://open-std.org/JTC1/SC22/WG21/docs/papers/2016/n4618.pdf rel = nofollow noreferrer> C ++ 17规范的最新草案称为分解声明,在第8.5节[dcl.decomp]中进行了定义。

In the most most recent draft of the C++17 specification it's called "Decomposition declarations" and is defined in section 8.5 [dcl.decomp].

这篇关于什么是自动包围列表语法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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