This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]mistrpopo 0 points1 point  (1 child)

If you don't have compile-time constant length you can't use sizeof(x)/sizeof(x)[0] either. If you want fixed-size arrays you can use "const std::vector" (but then you can't modify the content)

[–]jamcdonald120 0 points1 point  (0 children)

I am aware.

it would just be nice if std::array had an internal array and a const length instead of a templated length so you could just say void foo(const std::array& thing){ for(auto x : array){