Boost logo

Boost Users :

From: Filip Konvička (filip.konvicka_at_[hidden])
Date: 2007-06-04 06:47:00


> The expression to use should be something like:
>
> *(multi_index_helper<boost::multi_index::detail::hashed_index_node<$T1>*)
> (boost::multi_index::detail::hashed_index_node<$T1>*)
> (boost::multi_index::detail::hashed_index_node_trampoline<$T1>*)(&$e)
>
> which is entirely analogous to what you have for ordered and sequenced
> nodes.
>
Yes, it works well now. I tried that on friday and it did not, but now I
realize that I was probably passing a wrong $T1 to it. Just FYI, the
visualizer looks like this:

boost::multi_index::detail::header_holder<boost::multi_index::detail::hashed_index_node<*>,*>{
  preview(#("multi_index_container hashed data"))
  children(
    #(
      #array(
            expr : (($T2*)&$c)->buckets.spc.data_[$i],
            size : (($T2*)&$c)->buckets.size_
      ) :
(multi_index_helper_3<boost::multi_index::detail::hashed_index_node<$T1>
>*)(void*)&$e
    )
  )
}
multi_index_helper_3<boost::multi_index::detail::hashed_index_node<*> >{
  preview(#if (
((boost::multi_index::detail::hashed_index_node_impl*)&$c)->next_==((boost::multi_index::detail::hashed_index_node_impl*)&$c)
)
             (#("<empty bucket>"))
          #else (
             #("<non-empty bucket>")
          )
         )
  children(
    #(
      #list(
        head:
((boost::multi_index::detail::hashed_index_node_impl*)&$c)->next_,
        next: next_,
        skip: ((boost::multi_index::detail::hashed_index_node_impl*)&$c)
      ) :
*(multi_index_helper<boost::multi_index::detail::hashed_index_node<$T1>
>*)(boost::multi_index::detail::hashed_index_node<$T1>*)(boost::multi_index::detail::hashed_index_node_trampoline<$T1>*)(&$e)
    )
  )
}

So what I do is that I cast each "bucket" (hashed_index_node_impl*) to
my own type multi_index_helper_3<...>, which enables to visualize the
buckets individually, and to have access to the item type at the same
time. multi_index_helper_3 is defined as follows:

template<>
struct multi_index_helper_3<
    boost::multi_index::detail::multi_index_node_type<Type::value_type,
Type::index_specifier_type_list, std::allocator<Type::value_type> >::type
>
{ };

where Type is the type of the container.

[... some more coding ...]

random_access index was not difficult... I tried with the linked list
approach, but this was not so straightforward, so I used the array. It
looks like everything works, so thanks very much for your time and
patience! I'll post the new code, after some polishing, in the other thread.

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