1.1 --- a/src/work/marci/bug/ansi_pedantic_bug.cc Sun Apr 17 18:57:22 2005 +0000
1.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
1.3 @@ -1,60 +0,0 @@
1.4 -// -*- c++ -*-
1.5 -//compile it with
1.6 -//g++ -ansi -pedantic
1.7 -//and with
1.8 -//g++
1.9 -//I did with g++ ver 3.0.4, suse 8.0
1.10 -//If the template is removed from NodeMap, then it works well.
1.11 -//athos@cs.elte.hu
1.12 -//klao@cs.elte.hu
1.13 -//marci@cs.elte.hu
1.14 -
1.15 -class ListGraph {
1.16 -public:
1.17 - ListGraph() { }
1.18 -
1.19 - template <typename T> class NodeMap {
1.20 - const ListGraph& G;
1.21 - public:
1.22 - NodeMap(const ListGraph& _G) : G(_G) { }
1.23 - };
1.24 -
1.25 -};
1.26 -
1.27 -template<typename Graph> class GraphWrapper {
1.28 -protected:
1.29 - Graph* graph;
1.30 -public:
1.31 - GraphWrapper(Graph& _graph) : graph(&_graph) { }
1.32 -
1.33 - template<typename T> class NodeMap : public Graph::template NodeMap<T> {
1.34 - typedef typename Graph::template NodeMap<T> Parent;
1.35 - public:
1.36 - NodeMap(const GraphWrapper<Graph>& _G) :
1.37 - Parent(*(_G.graph)) { }
1.38 - };
1.39 -};
1.40 -
1.41 -template<typename Graph>
1.42 -class ResGraphWrapper : public GraphWrapper<Graph> {
1.43 -public:
1.44 - ResGraphWrapper(Graph& _graph) : GraphWrapper<Graph>(_graph) { }
1.45 -};
1.46 -
1.47 -template <typename Graph> class MaxFlow {
1.48 - const Graph* g;
1.49 - typedef ResGraphWrapper<const Graph> ResGW;
1.50 -public:
1.51 - MaxFlow(const Graph& _g) : g(&_g) { }
1.52 - void augmentOnShortestPath() {
1.53 - ResGW res_graph(*g);
1.54 - typename ResGW::template NodeMap<int> pred(res_graph);
1.55 - }
1.56 -};
1.57 -
1.58 -int main(int, char **) {
1.59 - ListGraph G;
1.60 - MaxFlow<ListGraph> max_flow_test(G);
1.61 - max_flow_test.augmentOnShortestPath();
1.62 - return 0;
1.63 -}