Boost logo

Boost Users :

From: Nicola Vitacolonna (vitacolo_at_[hidden])
Date: 2005-09-18 09:15:59


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;
}


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