
Jeremy Siek ha escrito:
In the docs
http://www.boost.org/libs/graph/doc/using_adjacency_list.html #sec:choosing-graph-type
it says that the container must meet the requirements of Sequence or RandomAccessContainer. Does multi_index_container meet these requirements? Also, the operations that are needed go through boost/pending/container_traits, so you may need to overload some functions like push() for multi_index_container.
From the POV of adjacency_list, multi_index_container can work as a sequence if its first index is of type sequenced. But I think this is not the OP's intention. What he has in mind (I think) is having multi_index_container function as a vertex store for adjacency_list while presenting additional indices for the user's convenience. And I
Hi Jeremy, think this cannot be done (in a simple manner) because adjacency_list chooses internally the type of the vertices (namely, some integer type from what I've been able to see in the source code): normally, one would want to store richer elements than that. What is wanted is a way to pass a predetermined instantiation of multi_index_container so that adjcacency_list can use it as is. One of the difficulties is that add_vertex is not passed an element at all, instead adjacency_list creates it internally. The intended mode of usage resembles more the following: typedef multi_index_container< element_type, indexed_by< sequenced<>, // to be used by the BGL ... // other indices
multi_index_t;
typedef adjacency_list< vecS, // some way to have adjcaceny_list accept multi_index_t ...
graph_t:
multi_index_t mic; // populate mic graph_t g; // bind mic to g: g won't be mutable. // use BGL with g See what I mean? I don't know if I came any close to explain myself clearly :) The first index of multi_index_t would act as the vertex store of g, while at the same time the user can access the elements through all the indices defined. If Alexander (OP) does not agree with my analysis please tell me so. Joaquín M López Muñoz Telefónica, Investigación y Desarrollo
Also, don't pass the address of the property into add_vertex, just pass by value.
Cheers, Jeremy
_______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost