Boost logo

Boost Users :

From: Filip Konvička (filip.konvicka_at_[hidden])
Date: 2007-05-28 05:30:35


Joaquín Mª López Muñoz (28.5.2007 7:49):
> Hello Filip, I did reply this email last Thursday, I guess somehow
> it didn't make it to your inbox (??) I'm copying and pasting my answer
> here again:
>
> Filip Konvi?ka ha escrito:
>
>
>> Joaquín Mª López Muñoz (23.5.2007 18:16):
>>
>>> Hello Filip,
>>>
>>> I know nothing about VS visualizers so I'm afraid I can't help much
>>> on that part, but feel free to ask as much as you need on the internal
>>> structures of B.MI --publicly of privately if you feel this is going to be
>>> a long list of mails.
>>>
>> [I tried replying to your email address, but I don't know whether this
>> ever reached you, so I retry here...]
>>
>> I tried some debugging with multi_index_container<int,
>> indexed_by<sequenced<> > >, which is probably the simplest case. I ended
>> up in the "space" member of "pod_value_holder", which seems to handle
>> some alignment issues and from the name I guess it should also contain
>> the data, but I don't see it in the debugger.
>>
>
> That "space" member is used as raw storage upon which the value
> (of type int in this case) is constructed. So, you have to reinterpret_cast
> to get to your value. Does the visualizer allow you to do that?
>
Yes, but if you look at the screenshot, you see that the space (resp.
space.data_.buf) is filled with 0xcd = -51 (i.e. uninitialized) values.
If I reinterpret the space member as int, I get 0xcdcdcdcd. So my
conclusion is that I'm looking at the "rear" node and I need to go to
the prior_ or next_ node, right? So I tried next_, but I got garbage
again, but this time it is not 0xcdcdcdcd but something a bit different.
I have inserted a "1" into the container, so I'd expect that the buffer
contained [0x01 0x00 0x00 0x00].

See screenshot - the expression shown is (sorry :-)))

(boost::multi_index::detail::index_node_base<int>*)(&(((*(boost::multi_index::detail::sequenced_index_node_impl*)(&(*(boost::multi_index::detail::sequenced_index_node_trampoline<boost::multi_index::detail::index_node_base<int>
>*)(&*(((*(boost::multi_index::detail::header_holder<boost::multi_index::detail::sequenced_index_node<boost::multi_index::detail::index_node_base<int>
>,boost::multi_index::multi_index_container<int,boost::multi_index::indexed_by<boost::multi_index::sequenced<boost::multi_index::tag<boost::mpl::na,boost::mpl::na,boost::mpl::na,boost::mpl::na,boost::mpl::na,boost::mpl::na,boost::mpl::na,boost::mpl::na,boost::mpl::na,boost::mpl::na,boost::mpl::na,boost::mpl::na,boost::mpl::na,boost::mpl::na,boost::mpl::na,boost::mpl::na,boost::mpl::na,boost::mpl::na,boost::mpl::na,boost::mpl::na>
>,boost::mpl::na,boost::mpl::na,boost::mpl::na,boost::mpl::na,boost::mpl::na,boost::mpl::na,boost::mpl::na,boost::mpl::na,boost::mpl::na,boost::mpl::na,boost::mpl::na,boost::mpl::na,boost::mpl::na,boost::mpl::na,boost::mpl::na,boost::mpl::na,boost::mpl::na,boost::mpl::na,boost::mpl::na>,std::allocator<int>
> >*)(&x))).member)))))).next_))

which in short is that the "next_" member from the previous screenshot
is cast to boost::multi_index::detail::index_node_base<int>. The int
value in the "space" member is 0x003aa06c.
>
>> As for sequenced_index_node_impl, this shows both _prior and _next, but
>> does not expose node data. See the attached snapshot. Do you have an idea
>> how could I see the one int that I inserted into the container?
>>
>
> Nodes of a multi-index container consist of several base classes each
> providing some part of the whole: the value (index_node_base) and
> pointers for each of the indices (one sequenced_index_node_impl in this
> case, as there is only one sequenced index.) In schematic form, the
> node you're deaing with now has the following structure:
>
> struct index_node_base
> {
> int value;
> };
>
> struct sequenced_index_node_impl
> {
> sequenced_index_node_impl* prior_;
> sequenced_index_node_impl* next_;
> }
>
> struct node_type:
> public index_node_base,
> public sequenced_index_node_impl
> {
> };
>
> So when you navigate through the sequenced index using prior_ and
> next_ pointers, you've got to down cast to node_type to get to
> the values.
>
> Is it clear (more or less)?
>
Yes, thanks.

Cheers,
Filip



sequenced_int_watch2.PNG

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