Boost logo

Boost :

Subject: [boost] type_with_alignment.hpp / alignment_of.hpp too heavy
From: Emil Dotchevski (emil_at_[hidden])
Date: 2008-09-30 15:23:17

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?

Emil Dotchevski
Reverge Studios, Inc.

Boost list run by bdawes at, gregod at, cpdaniel at, john at