Disclaimer: I only care about std::array. std::vector is obviously different.
The std::array::data()
function returns a pointer to the underlying data in the array: https://en.cppreference.com/w/cpp/container/array/data
Furthermore, my understanding is that the std::array
class will act like a simple struct with no overhead, that is, something like std::array<int, 3>
would be functionally equivalent to
struct Int3 {
int a,b,c;
};
This seems to imply to me that we should always find that for an std::array
called arr
&arr == arr.data()
Will this always be true? or is there something I am overlooking?