[Graph] Help on custom VertexList

Hi everybody, I want to use my custom container as a vertex list in a graph. I have followed the documentation, but I don't know exactly how I should overload the push() and erase() functions. The following example code, using boost::array, gives an error: "no matching function for call to 'container_category(boost::array<void*, 10ul>&)". Can someone help me? One more question: is it possible to get a reference to the vertex container, given an adjacency_list<...> object? Nicola #include <boost/graph/adjacency_list.hpp> #include <boost/array.hpp> struct arrayS { }; namespace boost { template <class ValueType> struct container_gen<arrayS, ValueType> { typedef array<ValueType, 10> type; }; } int main(int,char*[]) { typedef boost::adjacency_list<boost::vecS, arrayS, boost::bidirectionalS> Graph; Graph g(10); boost::add_vertex(g); boost::add_vertex(g); boost::add_edge(vertex(0, g), vertex(1, g), g); return 0; }

Hi Nicola, On Sep 18, 2005, at 9:15 AM, Nicola Vitacolonna wrote:
Hi everybody, I want to use my custom container as a vertex list in a graph. I have followed the documentation, but I don't know exactly how I should overload the push() and erase() functions.
Sorry, looks like the documentation is incomplete in that regard. I'll fix that. You can find examples of push() and erase() in: boost/pending/container_traits.hpp
The following example code, using boost::array, gives an error: "no matching function for call to 'container_category(boost::array<void*, 10ul>&)". Can someone help me?
You'll need to define a container_category function for boost::array. There are examples of this also in container_traits.hpp.
One more question: is it possible to get a reference to the vertex container, given an adjacency_list<...> object?
You're not suppose to, but if you must, the data member name is m_vertices. There is no guarantee that that name will stay the same, as that is not a publicly documented name. Cheers, Jeremy
participants (2)
-
Jeremy Siek
-
Nicola Vitacolonna