Boost logo

Boost Users :

Subject: Re: [Boost-users] Boost-users Digest, Vol 1945, Issue 2
From: Igor R (boost.lists_at_[hidden])
Date: 2009-03-25 06:22:10


> 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.


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net