marci@315: // -*- c++ -*- marci@315: //compile it with marci@315: //g++ -ansi -pedantic marci@315: //and with marci@315: //g++ marci@315: //I did with g++ ver 3.0.4, suse 8.0 marci@315: //If the template is removed from NodeMap, then it works well. marci@315: //athos@cs.elte.hu marci@315: //klao@cs.elte.hu marci@315: //marci@cs.elte.hu marci@315: marci@315: class ListGraph { marci@315: public: marci@315: ListGraph() { } marci@315: marci@315: template class NodeMap { marci@315: const ListGraph& G; marci@315: public: marci@315: NodeMap(const ListGraph& _G) : G(_G) { } marci@315: }; marci@315: marci@315: }; marci@315: marci@315: template class GraphWrapper { marci@315: protected: marci@315: Graph* graph; marci@315: public: marci@315: GraphWrapper(Graph& _graph) : graph(&_graph) { } marci@315: marci@315: template class NodeMap : public Graph::NodeMap { marci@315: public: marci@315: NodeMap(const GraphWrapper& _G) : marci@315: Graph::NodeMap(*(_G.graph)) { } marci@315: }; marci@315: }; marci@315: marci@315: template marci@315: class ResGraphWrapper : public GraphWrapper { marci@315: public: marci@315: ResGraphWrapper(Graph& _graph) : GraphWrapper(_graph) { } marci@315: }; marci@315: marci@315: template class MaxFlow { marci@315: const Graph* g; marci@315: typedef ResGraphWrapper ResGW; marci@315: public: marci@315: MaxFlow(const Graph& _g) : g(&_g) { } marci@315: void augmentOnShortestPath() { marci@315: ResGW res_graph(*g); marci@315: typename ResGW::NodeMap pred(res_graph); marci@315: } marci@315: }; marci@315: marci@315: int main(int, char **) { marci@315: ListGraph G; marci@315: MaxFlow max_flow_test(G); marci@315: max_flow_test.augmentOnShortestPath(); marci@315: return 0; marci@315: }