Adam Hunyadi Adam Hunyadi - 4 months ago 21
C++ Question

Is it safe to access std::array data by address?

I would like to use bitwise data conversion on std::array objects and for this I need to know if it is safe to store the address of the array, or if there is a function that changes the data location. For example:

std::array<int, 100> array;
int* startMarker =;
(filing the array and doing operations on it)
std::cout << *startMarker << std::endl;

Thanks for the answers.


std::array is of static size and the addresses kept for the interned data elements are stable (unlike as with std::vector).

So yes, its safe to keep these addresses.