Subject: Re: [boost] type_with_alignment.hpp / alignment_of.hpp too heavy
From: David Abrahams (dave_at_[hidden])
Date: 2008-09-30 16:11:48
on Tue Sep 30 2008, "Emil Dotchevski" <emil-AT-revergestudios.com> 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.)
> Then I thought that I could probably build my system by just using
> type_traits/alignment_of.hpp. It sure would be very light, right?
> Wrong, it also includes mpl and whatnot.
> I hope someone shares my frustration. Shouldn't at least
> alignment_of.hpp be much, much lighter? I'd think that all it should
> contain is whatever compiler-specific hacks are needed and that's it.
> What is the justification for including stuff like
> <boost/mpl/aux_/lambda_support.hpp> in alignment_of.hpp?
None in particular if your compiler isn't broken. It can just be hard
sometimes to limit the #includes that are brought in to support
workarounds. I'm sure Aleksey would be glad to get a patch.
-- Dave Abrahams BoostPro Computing http://www.boostpro.com