# HG changeset patch # User marci # Date 1081429918 0 # Node ID d9691d0102bd4d194e5618df8194dcd0b2a8cc6e # Parent 7b97540cd7430bd0d2f6c20e6e5d32689d20af1b bug diff -r 7b97540cd743 -r d9691d0102bd src/work/marci/ansi_pedantic_bug.cc --- a/src/work/marci/ansi_pedantic_bug.cc Thu Apr 08 12:03:49 2004 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,59 +0,0 @@ -// -*- 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 7b97540cd743 -r d9691d0102bd src/work/marci/bug/ansi_pedantic_bug.cc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/work/marci/bug/ansi_pedantic_bug.cc Thu Apr 08 13:11:58 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; +}