什么是自动括号列表语法?
What is the auto Bracketed List Syntax?
W.F. gave a now-deleted answer to my question 使用了以下行:
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 它被称为 "Decomposition declarations" 并在第 8.5 节中定义 [dcl.decomp].
W.F. gave a now-deleted answer to my question
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 它被称为 "Decomposition declarations" 并在第 8.5 节中定义 [dcl.decomp].