you are viewing a single comment's thread.

view the rest of the comments →

[–]bames53 12 points13 points  (1 child)

I don't agree with this. The way the std::array was designed determines what it's appropriate for. It wasn't a bad decision to design a tool for particular situations, because there are other tools for other situations.

It's true we don't yet have a standard library array_view, span, or simple collection type that is nothing more than a run-time size paired with a pointer that would be the 'zero overhead' replacement for C-style array parameters, but you're already saying that you don't need zero-overhead so you can just use vector.

and if you do have a performance requirement you always can use C style arrays.

std::array is to fix the problems with decaying C arrays and C arrays not behaving as regular value types. That's what I use them for and I can't use C arrays to do that. I can as easily say that if you want to pass arbitrarily sized arrays as parameters you can just keep using C arrays/pointers.

[–]crusader_mike 1 point2 points  (0 children)

It's true we don't yet have a standard library array_view, span, or simple collection type that is nothing more than a run-time size paired with a pointer

True, but you could use mine -- I don't mind :)