Boost logo

Boost Users :

From: Filip Konvička (filip.konvicka_at_[hidden])
Date: 2007-05-28 08:04:51


>> 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>*
>
Actually, not. I was simply drag&dropping the next_ pointer so that the
watch window derived the casts (it needs all explicit template
parameters, hence the mpl::na everywhere). The only cast I was doing was
the

boost::multi_index::detail::index_node_base<int>*

cast of the next_ pointer, which, as it seems, is not enough.
> 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
>
When I applied the above-mentioned casts to the next_ pointer, I saw the
int!! :-) I even tried substituting "next_" with "next_->next_" and I
saw the other elements.

The entire watch window expression to view the first element of the
container is:

(int&)((((*(boost::multi_index::detail::pod_value_holder<int>*)(&*(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>
>*)((*(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_)))).space).data_).buf

Thanks for now! Now I'll try to make a visualizer for this container and
see if that can be extended to other containers.

Cheers,
Filip


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