# HG changeset patch # User marci # Date 1081425829 0 # Node ID 7b97540cd7430bd0d2f6c20e6e5d32689d20af1b # Parent eabbe162e32ec9e656e529bec1c3680ac0083876 ansi pedantic bug in gcc diff -r eabbe162e32e -r 7b97540cd743 src/work/marci/ansi_pedantic_bug.cc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/work/marci/ansi_pedantic_bug.cc Thu Apr 08 12:03:49 2004 +0000 @@ -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@cs.elte.hu +//klao@cs.elte.hu +//marci@cs.elte.hu + +class ListGraph { +public: + ListGraph() { } + + template class NodeMap { + const ListGraph& G; + public: + NodeMap(const ListGraph& _G) : G(_G) { } + }; + +}; + +template class GraphWrapper { +protected: + Graph* graph; +public: + GraphWrapper(Graph& _graph) : graph(&_graph) { } + + template class NodeMap : public Graph::NodeMap { + public: + NodeMap(const GraphWrapper& _G) : + Graph::NodeMap(*(_G.graph)) { } + }; +}; + +template +class ResGraphWrapper : public GraphWrapper { +public: + ResGraphWrapper(Graph& _graph) : GraphWrapper(_graph) { } +}; + +template class MaxFlow { + const Graph* g; + typedef ResGraphWrapper ResGW; +public: + MaxFlow(const Graph& _g) : g(&_g) { } + void augmentOnShortestPath() { + ResGW res_graph(*g); + typename ResGW::NodeMap pred(res_graph); + } +}; + +int main(int, char **) { + ListGraph G; + MaxFlow max_flow_test(G); + max_flow_test.augmentOnShortestPath(); + return 0; +} diff -r eabbe162e32e -r 7b97540cd743 src/work/marci/makefile --- a/src/work/marci/makefile Wed Apr 07 17:42:05 2004 +0000 +++ b/src/work/marci/makefile Thu Apr 08 12:03:49 2004 +0000 @@ -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