Boost logo

Boost Users :

From: Joaquín Mª López Muñoz (joaquin_at_[hidden])
Date: 2007-05-28 06:48:03


Filip Konvi?ka ha escrito:

> 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?

Correct, I call it the "header" node. You must go to some other node to
see actual values, 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 :-)))

I'm not 100% sure, but I think you're not getting the casts right --if I'm
interpreting the expression correctly, you are applying the following casts
to the next_ pointer:

  a) to boost::multi_index::detail::sequenced_index_node_trampoline<
    boost::multi_index::detail::index_node_base<int> >*
  b) to boost::multi_index::detail::sequenced_index_node_impl*
  c) to boost::multi_index::detail::index_node_base<int>*

Is this the sequence of casts you're meaning to apply? If so, I think this
is wrong, what you should go thru is:

  a) to boost::multi_index::detail::sequenced_index_node_trampoline<
    boost::multi_index::detail::index_node_base<int> >*
  b) to boost::multi_index::detail::sequenced_index_node<
    boost::multi_index::detail::index_node_base<int> >*
  c) to boost::multi_index::detail::index_node_base<int>*

That is, if x is of type sequenced_index_node_impl you get to the
full node by evaluating:

(boost::multi_index::detail::index_node_base<int>*)
(boost::multi_index::detail::sequenced_index_node<
boost::multi_index::detail::index_node_base<int> >*)
(boost::multi_index::detail::sequenced_index_node_trampoline<
boost::multi_index::detail::index_node_base<int> >*)x

HTH,

Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo


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