Filip Konvi?ka ha escrito:
[...]
This is OK, but first I need to get the node "n", which seems hard. This
is because it is the "member" field of the container, which must be
accessed via some down-cast to header_holder, and Tx depends on
T2, but I can not derive Tx from T2 in the visualizer (I could use some
typedefs from multi_index::detail to get Tx, but this is not supported
by the debugger).
Specifically, given the multi_index_container<*,indexed_by<*>,*> >
pattern, I need to cast the container variable to
header_holder,
multi_index_container >,
where Q2 is something like
sequenced_index_node >, which I
don't know how to construct from T2.
OK, I think I begin to understand the limitations of the visualizer with
respect to type calculation. 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
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* --> header_holder_accessor*
and you get to the header_holder part by applying ".value". Now you can
move the rest of the work to a header_holder 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?
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo