Boost logo

Boost Users :

Subject: Re: [Boost-users] sizeof(boost::fusion:map)
From: Joel de Guzman (joel_at_[hidden])
Date: 2010-11-06 09:06:47


On 11/6/10 8:49 PM, Christopher Schmidt wrote:
> Joel de Guzman schrieb:
>> On 11/6/2010 7:56 AM, Christopher Schmidt wrote:
> [snip]
>>> I think gcc is correct. There are two distinct instances of X in B, and
>>> those may not have the same address. That's why there is that 4 byte
>>> displacement.
>>> It is pretty much the same in Fusion. All inbuilt sequences and the
>>> vector data storage share a common base class - fusion::sequence_root -
>>> that's where the 4 resp. 8 bytes come from.
>>
>> Good analysis, Christopher. We should do something about this.
>> sequence_root is only there for easy tag detection. There should
>> be better way.
>
> I committed a preliminary fix to the trunk. See
>
> https://svn.boost.org/trac/boost/changeset/66411
>
> for more details. It does not break Fusion and Proto on gcc 4.5.1
> -std=c++0x, gcc 4.5.1, msvc 10, msvc 9 and gcc 3.4.2 .
>
> I removed fusion::sequence_root and added an implicit conversion
> operator to fusion::sequence_base .
>
> https://svn.boost.org/trac/boost/browser/trunk/boost/fusion/support/sequence_base.hpp?rev=66411#L36
>
> Instead of using boost::is_base_of<fusion::sequence_root, Seq> to detect
> inbuilt fusion container we can use boost::is_convertible<Seq,
> fusion::detail::from_sequence_convertible_type> now.
>
> https://svn.boost.org/trac/boost/browser/trunk/boost/fusion/support/is_sequence.hpp?rev=66411#L34
>
> This solution is not pretty but it does not make the situation worse either.

Thanks, Christopher. That will do for now. I'm sure you can do
better though ;-)

Cheers,

-- 
Joel de Guzman
http://www.boostpro.com
http://spirit.sf.net

Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net