|
Boost Users : |
From: Filip KonviÄka (filip.konvicka_at_[hidden])
Date: 2007-05-31 03:07:50
> OK, I think I begin to understand the limitations of the visualizer with
> respect to type calculation.
>
This is my first visualizer, too ;-)
> I think you can circumvent this problem by exercising
> some hacks similar in spirit to your VISUALIZE_MULTI_INDEX_CONTAINER
> thing -but less intrusive. Define the following:
>
> template<typename Value,typename IndexSpecifierList,typename Allocator>
> struct header_holder_accessor:
> private ::boost::base_from_member<
> typename boost::detail::allocator::rebind_to<
> Allocator,
> typename boost::multi_index::detail::multi_index_node_type<
> Value,IndexSpecifierList,Allocator>::type
> >::type>
> {
> typedef typename boost::multi_index::detail::multi_index_node_type<
> Value,IndexSpecifierList,Allocator>::type node_type;
>
> node_type* value;
> };
>
> Now you can do the following cast in your visualizer:
>
> multi_index_container<T1,T2,T3>* --> header_holder_accessor<T1,T2,T3>*
>
> and you get to the header_holder part by applying ".value". Now you can
> move the rest of the work to a header_holder<Q1,Q2> visualizer.
>
> Similarly, if you define
>
> template<typename Super>
> struct sequenced_index_node_value_accessor
> {
> typedef typename Super::value_type value_type;
> value_type value;
> };
>
> when you're in the sequenced_index_node<T1> visualizer you can do the
> following cast
>
> sequenced_index_node<T1>* --> sequenced_index_node_value_accessor<T1>*
>
> and get to the value by applying ".value", which automagically has the right
> type. Does this help work around the limitations of the visualizer?
>
Yes, I see we have similar ideas! What did you find intrusive about the
macro? The explicit template instantiation is as it seems indispensable,
because the debugger can only work with types that are touched (and
reported to the debuggger via debug info) by the compiler. This also
explains why the debugger does not see type aliases (typedefs, global or
local).
I did some more experiments last night and today, and I have found a
solution that works with any container whose index list starts with
sequenced<>. There is a nasty hack which extracts the node count from
within a header_holder visualizer (formerly this was a
sequenced_index_node visualizer).
From my point of view, this is more than I expected that would be
possible, thanks very much for your assistance!
I'll post the resulting code in a new thread so that it's easier for
others to test it or comment on it.
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