Boost logo

Boost Users :

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


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?

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

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