
25 Mar
2009
25 Mar
'09
10:22 a.m.
but in this case array_size is re-assigned after p_array was allocated, thus not reflecting the size of the allocated buffer;
The order of initialization is following: 1) Base::size 2) Base::p_array So the array is allocated after the size is assigned.
I need some dynamically allocated space that can later be casted to C pointers, so that it can be passed to a Win32 API function that accepts C pointers only. vectors are dynamic, but they don't cast to C arrays naturally.
std::vector provides the guarantee that its elements are in contigous memory block, so &*vec.begin() is a ptr to c-like array.