
Emil Dotchevski wrote:
I need to allocate an object of type T, but I also need to bundle it in a single memory allocation with an object of class U. Something like "new std::pair<T,U>" would work, except that U is a rather heavy type and I want to pimpl it away into a cpp.
This means that the cpp needs to deal with the alignment of T and U when allocating the memory. For that purpose, I could use type_traits/type_with_alignment.hpp in my header, but when I looked at it, I was blown away by how much crap it includes (remember, I want my header to be very very light.)
Sorry if I'm missing something, but why would you need to include these headers in your header? Just forward-declare your internal pimpl class and define it in cpp. It is cpp where you would include type_with_alignment.hpp & co. and this is not that critical, is it?