W.F. gave a now-deleted answer to my question here which used the line:
auto [x, y] = div_t{ 1, 0 };
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;
}
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].
来源:https://stackoverflow.com/questions/41569419/what-is-the-auto-bracketed-list-syntax