C++ Logo

std-proposals

Advanced search

[std-proposals] Add array data initialization like in C

From: Comical USA <comicalusa_at_[hidden]>
Date: Tue, 10 Nov 2026 20:03:50 +0000
In C you can do
int a[5] = {
[3] = 2,
};

which will make the array 0, 0, 2, 0, 0

but on C++ you can do that only with lambda or like this int a[] = { 0, 0,
2, 0, 0 } or after initializating you must do a[3] = 2; and it's pretty
annoying, can we get in C++29 this C feature?

Received on 2026-11-10 20:04:03