From: Joel de Guzman (djowel_at_[hidden])
Date: 2003-04-16 18:22:07
Douglas Gregor wrote:
> type_with_alignment was generating huge types on most platforms,
> because it would take every type with the right alignment into a
> union. On x86, for instance, double and int have the same alignment
> (4), so sizeof(type_with_alignment<4>::type)=12! type_with_alignment
> now takes the first type whose alignment matches, and the types are
> roughly ordered by size, so the resulting type size should be smaller.
Doug, this is GOOD! You da man!
I've just switched Spirit's match class to use boost::optional. Before
your patch, I get:
sizeof(match<int>) == 20
sizeof(match<double>) == 32
Now, I have:
sizeof(match<int>) == 12
sizeof(match<double>) == 24
Still 4 to 8 bytes more than the pre-optional code:
sizeof(match<int>) == 8
sizeof(match<double>) == 16
But it will do... Heh... can I ask for more :-)?
-- Joel de Guzman joel at boost-consulting.com http://www.boost-consulting.com http://spirit.sf.net
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk