but but C++ vectors are just as performant as arrays!i guarantee you they are not. why? because vector element access goes though operator[], whereas array[] is just syntactic sugar. so you have a function call that returns a reference. and since the C++ stdlib is dynamically linked virtually everywhere, there’s no way for the compiler to optimize this even with LTO.
@mia unless your stdlib is compiled with assertions, the operator[] is no different from the array syntactic sugar, because it just gets inlined from the header
@mia in the end any access on vector is no different from a bunch of allocated memory, because that's all it is
where c++ vector actually suffers performance-wise is growth, because c++ allocators have no concept of realloc, which means you are allocating new data + copying + freeing the old each time the capacity increases (in practice it does not matter too much)