1. 2
    1. 3

      There is no point in using std::vector if the size remains contant. There is std::array for that, which has a (mostly) compile-time interface that is comparable to primitive C arrays.

      1. 1

        Two things to note though are that you have to know the size at compile time, and std::array has automatic storage duration, so depending on size and environment that may be prohibitive.

        I think the problem is the intersection between needing a large fixed size array and not being able to pay the overhead of storing the one extra pointer in a std::vector is fairly small.

    2. 2

      Next in the series, why you should not use std::unique_ptr

    3. 1

      I’m unsure why double init is being seen, unless considering a resize operation that initialized the fields to be “bad”. Failing to properly initialize C arrays has resulted in many security bugs over the years. Similarly all rust types guarantee initialization.

      But as others have said, a resizable data type for fixed size arrays is simply not the best choice. One of my pet peeves with rust is how it forces you into Vec for so many things meaning you lose type system size enforcement.