[Lemon-commits] [lemon_svn] marci: r433 - hugo/trunk/src/work/marci

Lemon SVN svn at lemon.cs.elte.hu
Mon Nov 6 20:39:25 CET 2006


Author: marci
Date: Thu Apr  8 14:03:49 2004
New Revision: 433

Added:
   hugo/trunk/src/work/marci/ansi_pedantic_bug.cc
Modified:
   hugo/trunk/src/work/marci/makefile

Log:
ansi pedantic bug in gcc


Added: hugo/trunk/src/work/marci/ansi_pedantic_bug.cc
==============================================================================
--- (empty file)
+++ hugo/trunk/src/work/marci/ansi_pedantic_bug.cc	Thu Apr  8 14:03:49 2004
@@ -0,0 +1,59 @@
+// -*- c++ -*-
+//compile it with 
+//g++ -ansi -pedantic
+//and with 
+//g++
+//I did with g++ ver 3.0.4, suse 8.0
+//If the template is removed from NodeMap, then it works well.
+//athos at cs.elte.hu
+//klao at cs.elte.hu
+//marci at cs.elte.hu
+
+class ListGraph {
+public:
+  ListGraph() { }
+
+  template <typename T> class NodeMap {
+    const ListGraph& G; 
+  public:
+    NodeMap(const ListGraph& _G) : G(_G) { }
+  };
+
+};
+
+template<typename Graph> class GraphWrapper {
+protected:
+  Graph* graph;
+public:
+  GraphWrapper(Graph& _graph) : graph(&_graph) { }
+ 
+  template<typename T> class NodeMap : public Graph::NodeMap<T> { 
+  public:
+    NodeMap(const GraphWrapper<Graph>& _G) :  
+      Graph::NodeMap<T>(*(_G.graph)) { }
+  };
+};
+
+template<typename Graph>
+class ResGraphWrapper : public GraphWrapper<Graph> {
+public:
+  ResGraphWrapper(Graph& _graph) : GraphWrapper<Graph>(_graph) { }
+};
+
+template <typename Graph> class MaxFlow {
+  const Graph* g;
+  typedef ResGraphWrapper<const Graph> ResGW;
+public:
+  MaxFlow(const Graph& _g) : g(&_g) { }
+  void augmentOnShortestPath() {
+    ResGW res_graph(*g);
+    typename ResGW::NodeMap<int> pred(res_graph); 
+  }
+};
+
+int main(int, char **) {
+  ListGraph G;
+  MaxFlow<ListGraph> max_flow_test(G);
+  max_flow_test.augmentOnShortestPath();
+  return 0;
+}

Modified: hugo/trunk/src/work/marci/makefile
==============================================================================
--- hugo/trunk/src/work/marci/makefile	(original)
+++ hugo/trunk/src/work/marci/makefile	Thu Apr  8 14:03:49 2004
@@ -9,7 +9,7 @@
 BOOSTROOT ?= /home/marci/boost
 INCLUDEDIRS ?= -I../../include -I.. -I../{marci,jacint,alpar,klao,akos,athos} -I$(BOOSTROOT)
 LEDAINCLUDE ?= -I$(LEDAROOT)/incl
-CXXFLAGS = -g -O -W -Wall $(INCLUDEDIRS) -ansi -pedantic
+CXXFLAGS = -g -O -W -Wall $(INCLUDEDIRS) #-ansi -pedantic
 
 LEDABINARIES = lg_vs_sg leda_graph_demo leda_bfs_dfs max_bipartite_matching_demo
 BINARIES = edmonds_karp_demo iterator_bfs_demo



More information about the Lemon-commits mailing list