Answer. Yes, it is safe.
Standard says (I am using draft version but you can find it in 03):
“The elements of a vector are stored contiguously,
meaning that if v is a vector<T, Allocator> where T is some type other
than bool, then it obeys the identity &v[n] == &v[0] + n for all 0 <=
n < v.size().”
So, if you are not using std::vector<bool> or with non POD types, then you can
do this quite safely:
#include <assert.h>
#include <vector>
int main(){
std::vector<int> vec;
vec.push_back(1);
vec.push_back(2);
int arr[2] = {1, 2};
assert(0 == memcmp(&arr[0], &vec[0], vec.size()));
return 0;
}