I know I can use std::array<Type, Size>
to a have an array of the type Type
and a size, which is fix at compile time.
Furthermore, std::vector
can be used, if the size is not fixed at compile time, but given at runtime.
Is there an std container, which can be set at runtime to a certain size and this size is than unchangeable? My intend is to get a compile error, if the size is changed after the creation of this container.
Of course this can be archived with old school arrays using pointers. Nevertheless, this also comes with the disadvantage of having to pass the pointer and the length to a function?