I was told that in C++, one should always use std::array
over c-style array.
After viewing around questions I come across people saying that std::array is better.
In that sense, I used a lot of std::array
and sometimes when I use other libraries, I have to use methods that takes in c-style arrays.
For example, I am working with this function
void Draw(float* arg);
Is it possible to pass in std::array<float,4>
as a parameter?
Will there be any undefined behavior if I were to pass in &vec4[0] as the parameter?
In that sense, will it be the same for multi-dimensional arrays?
With this array declared as
std::array<std::array<float,4>,4>;
Will there also be any undefined behavior if I were to pass in &mtx4[0][0] as the parameter?
Edit: Thanks for pointing out my error in the code for the multidimensional array. I edited it.