Date: Thu, 26 Jun 2025 18:38:42 -0400
So, you want:
```
std::array<int, 5> arr{1, 2, 3, 4, 5};
```
To mean one thing, while:
```
std::vector<int> arr{1, 2, 3, 4, 5};
```
To just... not work at all.
Half the point of list initialization syntax is so that containers and
aggregates can use the same syntax to achieve conceptually identical
results.
Now yes, if the array was of some move-only types, and the
initializers were all prvalues, this wouldn't work with the `vector`
version. But it would in basically every other case. What you're
wanting makes it just never work at all.
```
std::array<int, 5> arr{1, 2, 3, 4, 5};
```
To mean one thing, while:
```
std::vector<int> arr{1, 2, 3, 4, 5};
```
To just... not work at all.
Half the point of list initialization syntax is so that containers and
aggregates can use the same syntax to achieve conceptually identical
results.
Now yes, if the array was of some move-only types, and the
initializers were all prvalues, this wouldn't work with the `vector`
version. But it would in basically every other case. What you're
wanting makes it just never work at all.
Received on 2025-06-26 22:38:54