Why is there not only 1 type with the best performance, to define a list at compile time?
The benchmark is clear, the constexpr std::initializer_list
is faster, uses even less memory and the IO-reads are astonishingly less over constexpr std::array
:
https://build-bench.com/b/1EDAcFjJ6NACk4Pg4tG2nbsEx0A
Why do people praise std::array
even if you have to add the number of elements (how stupid is that, when adding another element, you need to change 2 lines, and why can't std::array
not deduce the length automatically?).
So why didn't they implement the array subscription methods to std::initializer_list
make std::array
unnecessary.
Aucun commentaire:
Enregistrer un commentaire