Questions tagged [brace-elision]
3 questions
4
votes
2 answers
How do I solve the ambiguity of brace-elisioning with list-initializers in C++?
I want to make my own struct for a 3x3 Matrix. I want to allow construction via components/elements or by "rows".
So either you provide a std::array or a std::array, 3>
However when defining the struct like this with…

TheHelpfulHelper
- 57
- 6
2
votes
1 answer
Count the fields with plain arrays of POD type in C++17?
I collected the following from several snippets, using the technique of testing the ability of aggregate-initialization, and transforming the struct into a tuple for counting the size, but when there is an array, the struct could be brace-elided and…

Anqur
- 111
- 1
- 4
2
votes
1 answer
GCC does not support brace elision in a new-expression
Consider this program:
struct S {
int m;
};
int main() {
S s_arr[1]{0};
S *s_new = new S[1]{0};
int i_arr[1][1]{0};
int (*i_new)[1] = new int[1][1]{0};
return 0;
}
I think all four variables in the main function should be…

fefe
- 3,342
- 2
- 23
- 45