gpt4 book ai didi

c++ - 什么是自动括号列表语法?

转载 作者:搜寻专家 更新时间:2023-10-30 23:53:20 25 4
gpt4 key购买 nike

W.F.对我的问题给出了现已删除的答案 here它使用了这条线:

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

从答案中的代码来看,它看起来像是 div_t 结构的 tie。我希望有人能解释这里发生了什么。完整的功能代码如下:

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

最佳答案

在最most recent draft of the C++17 specification它称为“分解声明”,在第 8.5 节 [dcl.decomp] 中定义。

关于c++ - 什么是自动括号列表语法?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41569419/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com