Reputation: 1952
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 = array.data();
(filing the array and doing operations on it)
std::cout << *startMarker << std::endl;
Thanks for the answers.
Upvotes: 2
Views: 1559
Reputation: 1
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.
Upvotes: 8