* arm.md (stack_tie): New insn. Use an idiom that the alias code
[official-gcc.git] / gcc / testsuite / g++.old-deja / g++.robertl / eb109.C
blob7a7c56cd34f9a81ec803b9fc1622a5ffb072cc21
1 #include<map>
2 #include<iostream>
3 #include<vector>
4 #include<string>
6 using namespace std;
8 // empty parameter class with a minimal set of operations
9 // if there are no weights for edges necessary
10 struct Empty
12   public:
13     Empty(int=0) {}
14     bool operator<(const Empty&) const { return true;}
16 inline ostream& operator<<(ostream& os, const Empty&) { return os;}
17 inline istream& operator>>(istream& is, Empty& ) { return is;}
20 template<class VertexType, class EdgeType>
21 class Graph
22 {  // ERROR - candidates
23   public:
24     // public type interface
25     typedef std::map<int, EdgeType > Successor;
26     typedef std::pair<VertexType, Successor> vertex;
27     typedef std::vector<vertex> GraphType;
28     typedef typename GraphType::iterator iterator;
29     typedef typename GraphType::const_iterator const_iterator;
31   // a lot of stuff deleted ....
33   private:
34     bool directed;
35     GraphType C;          // container
36     ostream* pOut;
39 // all graph-methods delet
40 template<class VertexType, class EdgeType>
41 ostream& operator<<(ostream& os, Graph<VertexType,EdgeType>& G)
43     // display of vertices with successors
44   for(int i = 0; i < G.size(); ++i)  // ERROR - no size function
45     {
46       os << G[i].first << " <";      // ERROR - no index operator
48         // The compiler does not like this line!!!!!!
49         typename Graph<VertexType, EdgeType>::Successor::iterator
50           startN = G[i].second.begin(), // ERROR - no index operator
51           endN   = G[i].second.end();  // ERROR - no index operator
53         while(startN != endN)
54         {
55             os << G[(*startN).first].first << ' ' // ERROR - no index operator
56                << (*startN).second << ' ';
57             ++startN;
58         }
59         os << ">\n";
60     }
61     return os;
64 int main()
66     // no edge weighting, therefore type Empty:
67     Graph<std::string, Empty> V(true);        // ERROR - no bool constructor
68     // ReadGraph(V, "gra1.dat");
70     // display of vertices with successors
71     cout << V;