custom allocation for boost::array

Hi, Is it safe to do this? using boost::array; const size_t n; void* p = new char[sizeof(T) * n]; array<T, n>* data = new(p) array<T, n>; The reason I want to do this is that I have implemented my own memory pool, so new char[...] would be replaced by my_pool<T>::allocate(n). I don't want to use something like my_pool<array<T, n> >::allocate(1), because then my allocator would have to align the allocated memory to the total array size instead of just the size of its elements. I suppose the safest solution would be an implementation of array with dynamic memory and support for a standard allocator like, for example, a one-dimensional multi_array or even multi_array_ref? I am concerned about performance of those containers, however. Regards, Clemens
participants (1)
-
Clemens Buchacher